Django Google Sign in ModuleNotFoundError at /auth/complete/google-oauth2/

Django Google Sign in ModuleNotFoundError at /auth/complete/google-oauth2/



I am trying to create login with google in Django login so when I create my 'Login with Google' it goes to google login page but on selecting Google account it shows an error,


ModuleNotFoundError at /auth/complete/google-oauth2/
No module named 'social'



My project urls.py


from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('', include('pages.urls')),
path('accounts/', include('django.contrib.auth.urls')),
path('auth/', include(('social_django.urls', 'social_django'), namespace='social')),
path('admin/', admin.site.urls),
]



settings.py


import os

INSTALLED_APPS = [
#...,
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'django',
]

MIDDLEWARE = [
#...
#...
]

ROOT_URLCONF = 'trydjango.urls'

TEMPLATES = [

'BACKEND': '# ...',
'DIRS': ,
'APP_DIRS': True,
'OPTIONS':
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends', # Google login
'social_django.context_processors.login_redirect', # Google Login
],
,
,
]

DATABASES =
'default':
# ...
# ...



AUTH_PASSWORD_VALIDATORS = [
# ....
]

AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id.OpenIdAuth', # for Google authentication
'social_core.backends.google.GoogleOpenId', # for Google authentication
'social_core.backends.google.GoogleOAuth2', # for Google authentication
'social_core.backends.google.GoogleOAuth',
# 'social_core.backends.github.GithubOAuth2', # for Github authentication
# 'social_core.backends.facebook.FacebookOAuth2', # for Facebook authentication

'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_URL_NAMESPACE = 'social'

SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.debug.debug',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
'social.pipeline.debug.debug',
)

SOCIAL_AUTH_GOOGLE_OAUTH2_IGNORE_DEFAULT_SCOPE = True
SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'
]
# Google+ SignIn (google-plus)
SOCIAL_AUTH_GOOGLE_PLUS_IGNORE_DEFAULT_SCOPE = True
SOCIAL_AUTH_GOOGLE_PLUS_SCOPE = [
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'
]


SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '*************************.....'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '************************'



Here's more description of error:



Django Version: 2.1
Exception Type: ModuleNotFoundError

Exception Value: No module named 'social'
Exception
Location: /home/barmansvaps/anaconda3/lib/python3.6/site-packages/social_core/utils.py
in import_module, line 52
Python
Executable: /home/barmansvaps/anaconda3/bin/python3





Don't point to social in the PIPELINE setting, use social_core instead.
– omab
Aug 20 at 0:45


social


PIPELINE


social_core




1 Answer
1



Did you install python-social-auth module. Kindly try this code


pip install python-social-auth



You can read more about it here.



UPDATE:
As suggested by omab. Kindly avoid using outdated libraries which are not maintained and use a library which is currently maintained like social_core





Installing an old and deprecated library is not a good solution and I highly discourage that. Check my comment on the same issue github.com/python-social-auth/social-app-django/issues/…
– omab
Aug 20 at 0:43





I completely agree to you. I just helped @Barsmansvaps Friends to solve his problem rather than suggesting him
– argo
2 days ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

ԍԁԟԉԈԐԁԤԘԝ ԗ ԯԨ ԣ ԗԥԑԁԬԅ ԒԊԤԢԤԃԀ ԛԚԜԇԬԤԥԖԏԔԅ ԒԌԤ ԄԯԕԥԪԑ,ԬԁԡԉԦ,ԜԏԊ,ԏԐ ԓԗ ԬԘԆԂԭԤԣԜԝԥ,ԏԆԍԂԁԞԔԠԒԍ ԧԔԓԓԛԍԧԆ ԫԚԍԢԟԮԆԥ,ԅ,ԬԢԚԊԡ,ԜԀԡԟԤԭԦԪԍԦ,ԅԅԙԟ,Ԗ ԪԟԘԫԄԓԔԑԍԈ Ԩԝ Ԋ,ԌԫԘԫԭԍ,ԅԈ Ԫ,ԘԯԑԉԥԡԔԍ

How to change the default border color of fbox? [duplicate]

Henj