google login in django do not give email and username instead give first_name and last_name in django_rest_social_oauth2 and update value superuser

Viewed 7

using google login in django do not give email and username instead give first_name and last_name only and update that in my superuser in django_rest_social_oauth2

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile']

SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True 
SOCIAL_AUTH_GOOGLE_OAUTH2_USER_FIELDS = ['first_name', 'last_name', 'email','username']
AUTHENTICATION_BACKENDS = (
# Facebook OAuth2
'social_core.backends.facebook.FacebookAppOAuth2',
'social_core.backends.facebook.FacebookOAuth2',

# Google OAuth2
'social_core.backends.google.GoogleOAuth2',

# django-rest-framework-social-oauth2
'rest_framework_social_oauth2.backends.DjangoOAuth2',

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

SOCIAL_AUTH_USER_MODEL = '<custom user model>'
0 Answers
Related