1

I am trying to integrate Google login in my website ..I am following this example: https://developers.google.com/identity/sign-in/web/

I followed http://www.marinamele.com/user-authentication-with-google-using-django-allauth as well,

I generated client id for my project and replaced it in above code, my settings.py is as follows:

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)

SITE_ID = 1
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_VERIFICATION = "none"
LOGIN_REDIRECT_URL = '/'
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_PROVIDERS = \
{
'google': {
    'SCOPE': ['profile','email'],
    'AUTH_PARAMS': {'auth_type': 'reauthenticate', 'access_type':'online'},
    'METHOD': 'oauth2',
    'VERIFIED_EMAIL': False
}
}
TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, "templates")],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.contrib.auth.context_processors.auth',
            'django.template.context_processors.debug',
            'django.template.context_processors.i18n',
            'django.template.context_processors.media',
            'django.template.context_processors.static',
            'django.template.context_processors.tz',
            'django.contrib.messages.context_processors.messages',
            # Required by allauth template tags
            "django.core.context_processors.request",
            # allauth specific context processors
            "allauth.account.context_processors.account",
            "allauth.socialaccount.context_processors.socialaccount",
        ],
    },
   },
]

I keep getting this error upon login from my page:

404: That’s an error.

Error: invalid_request

Permission denied to generate login hint for target domain.
veraliesim
  • 33
  • 1
  • 9
  • Possible duplicate of [Google sign in website Error : Permission denied to generate login hint for target domain](http://stackoverflow.com/questions/32041418/google-sign-in-website-error-permission-denied-to-generate-login-hint-for-targ) – tony gil Feb 03 '16 at 13:30
  • i apologize for voting to close, but there was exactly the same situation (without your specific code, which does not affect solution) asked the day before you asked yours. yours is a pertinent question. UPVOTED if that measns anything – tony gil Feb 03 '16 at 13:32

1 Answers1

7

I had this similar error in javascript.

In my case it was Authorized JavaScript origins mismatch. Check your Authorized JavaScript origins against your OAuth2 clientID in developer console. If you are working on localhost sure to add that and run your application with localhost instead of 127.0.0.1 OR 0.0.0.0

Hope this Helps.

arifin4web
  • 696
  • 8
  • 12