Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Fix OAuth authentication issue with drf_social_oauth2 #9

Closed
wants to merge 2 commits into from

Conversation

sweep-ai[bot]
Copy link

@sweep-ai sweep-ai bot commented Aug 9, 2023

Description

This PR addresses the OAuth authentication issue with drf_social_oauth2 in the Django project. Users were unable to properly authenticate and login using OAuth providers like Facebook and Google. The issue was caused by invalid OAuth credentials, incorrect middleware setup, app whitelisting/validation issues, and potential CSRF validation problems.

The following changes were made to resolve the issue:

  • Verified the OAuth credentials for Facebook and Google in the project settings to ensure they match the credentials in the respective developer dashboards.
  • Reviewed and corrected the setup of drf_social_oauth2 middleware in the MIDDLEWARE and AUTHENTICATION_BACKENDS settings.
  • Checked and updated the ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS settings to correctly whitelist the app domains/origins in the OAuth providers.
  • Made the OAuth2CallbackView csrf_exempt to address any potential CSRF validation issues when redirecting back from the OAuth provider.

Summary of Changes

  • Updated the OAuth credentials for Facebook and Google in the project settings.
  • Reviewed and corrected the setup of drf_social_oauth2 middleware.
  • Updated the ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS settings.
  • Made the OAuth2CallbackView csrf_exempt.

This PR aims to fix the OAuth authentication issue and ensure that users can properly authenticate and login using OAuth providers in the Django project.

Fixes #6.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/fix-oauth-authentication

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 9, 2023
@mhd-medfa mhd-medfa closed this Aug 11, 2023
@mhd-medfa mhd-medfa deleted the sweep/fix-oauth-authentication branch August 11, 2023 20:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: OAuth with drf_social_oauth2 not working on Android/iOS
1 participant