Django sudden error: "AuthMissingParameter at /complete/google-oauth2/", when using GoogleOAuth2 from social-auth-app-django package

Viewed 132

I have a running Django application (runs for already 2 years+). I'm using the social-auth-app-django to manage my users authentication with Google.

Suddenly today i got errors from users that can not get inside my app. I also get the same error on my local and production environment:

enter image description here

My settings.py related params are:

AUTHENTICATION_BACKENDS = (
    'social_core.backends.google.GoogleOAuth2',
    'django.contrib.auth.backends.ModelBackend',
)

## Google Credentials
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = os.environ.get('GOOGLE_AUTH_KEY')
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = os.environ.get('GOOGLE_AUTH_SECRET')
print("TESTING")
print("SOCIAL_AUTH_GOOGLE_OAUTH2_KEY:\n", SOCIAL_AUTH_GOOGLE_OAUTH2_KEY)
print("SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET:\n", SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET)
SOCIAL_AUTH_URL_NAMESPACE = 'social'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'http://MyAppHost/complete/google-oauth2/'


# Login URL
LOGIN_URL = '/login/google-oauth2/'
# Where user is directed after login/logout
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'

I double verified that the SOCIAL_AUTH_GOOGLE_OAUTH2_KEY and SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET really match what i see in the google API-credentials page

Moreover, i verified that my Authorized redirect URIs configured properly.

When i try to enter the URL presented in the redirect_uri (http://localhost:5000/complete/google-oauth2/) i get the error:


AuthMissingParameter at /complete/google-oauth2/
Missing needed parameter state
Request Method: GET
Request URL:    http://localhost:8000/complete/google-oauth2/
Django Version: 2.2.3
Exception Type: AuthMissingParameter
Exception Value:    
Missing needed parameter state
Exception Location: /Volumes/dev/venv/lib/python3.6/site-packages/social_core/backends/oauth.py in validate_state, line 85
Python Executable:  /Volumes/dev/venv/bin/python3
Python Version: 3.6.2
0 Answers
Related