问题
I am using Google OAuth for my Django App (via allauth package)
I have followed all standard configuration steps. In Google Developer console here's what i have:
Authorized JavaScript origins
https://example.com
Authorized redirect URIs
https://example.com/accounts/google/login/callback/ - login fails
http://example.com/accounts/google/login/callback/ - login succeeds
What i observe that if i have a https redirect URL in Authorized redirect URIs, it does not allow login and it fails with redirect_uri_mismatch Error. If i have a http redirect URL then the login succeeds.
What do i need to do to have a https enabled redirect URL ?
回答1:
Adding the following in production settings.py fixed the problem for me:
ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
回答2:
**This worked for me :
- Go to https://console.developers.google.com
- Add without port http://127.0.0.1/accounts/google/login/callback/
- Also Add http://localhost/accounts/google/login/callback/
- see the image in the link for detail
See image by opening link
来源:https://stackoverflow.com/questions/54784981/django-allauth-google-oauth-redirect-uri-mismatch-error