Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REDIRECT_URL configuration not working after (big) upgrade #389

Open
hovi opened this issue Sep 21, 2022 · 4 comments
Open

REDIRECT_URL configuration not working after (big) upgrade #389

hovi opened this issue Sep 21, 2022 · 4 comments

Comments

@hovi
Copy link

hovi commented Sep 21, 2022

I have been using this library for years. Now I was finally able to upgrade the project from python 2 to python 3 and from django 1.x to 3.x (yes, shame on me for doing it this late!).

I have configured apple and google-oauth2, which have been working in the old setup till now. The configuration includes:
SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URL
and
SOCIAL_AUTH_APPLE_ID_OAUTH2_REDIRECT_URL

Expected behaviour

When I click on login buttons, oauth request sets correctly redirect_uri parameter as per config.

Actual behaviour

Request sets different "default" redirect_uri no matter what and I get error because the redirect_uri is incorrect (not authorized) for both backends.

I got my google oauth working by adding the "default" redirect_uri to my authorised redirect URIs in the google console, so my configuration is otherwise fine. I'd like to keep my "old" custom redirect uris if possible though.

It's really cool by the way that the library otherwise works even after upgrading a few major versions years later.

I don't see those REDIRECT_URL strings anywhere in the documentation. Have they been removed? If so, what is the alternative? Please advice :)

@hoossainalik
Copy link

@hovi Were you able to resolve this issue I am facing the same issue.

@hovi
Copy link
Author

hovi commented Dec 7, 2022

Unfortunately no. I ended up modifying my login settings to match the default settings.

@nijel
Copy link
Member

nijel commented Dec 8, 2022

Shouldn't it be SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_REDIRECT_URL instead of SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URL?

@hoossainalik
Copy link

hoossainalik commented Dec 8, 2022

If it is of any help to anyone, my issue got solved by setting the REDIRECT URI to "postmessage" as I was using Authorization Code Flow for Google Oauth2. Otherwise, even if I had the identical URI in Google Cloud Console and in Django Settings, every time I got a redirect_uri_mismatch error.

It is a shame that this is not documented properly anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants