I am successfully using Django Social Auth to login users with Facebook. I'm trying to implement Google OAuth2. I have taken all the steps I know of to integrate it, but I'm getting an AuthCanceled at /complete/google-oauth2/
exception even when I click Allow access
. Here's what I did to integrate it:
http://mysite/complete/google-oauth2
, before I did that I got "unauthorized redirect url" from Google.In my settings.py I have
GOOGLE_OAUTH2_CLIENT_ID = '*****'
GOOGLE_OAUTH2_CLIENT_SECRET = '*****'
AUTHENTICATION_BACKENDS = (
'social_auth.backends.google.GoogleOAuth2Backend',
'social_auth.backends.facebook.FacebookBackend',
'django.contrib.auth.backends.ModelBackend',
)
Whan am I doing wrong? How can I fix/debug that AuthCancelled exception?
The problem appears to be caused by a strange Google behavior: when I initially created my client ID, google gave me this client ID: 193271111225.apps.googleusercontent.com
. After a conversation with the library author, he told me that his ids were much longer, so I created a new client ID with the exact same settings. The new ID generated was 193271111225-cvltnldi4hh5lmo784v2ir451b3rij7e.apps.googleusercontent.com
and with it, it worked. Both IDs look the same in the console, but only the latter works.