Giancarlo Ventura
Giancarlo Ventura

Reputation: 857

python social auth: get email from Google OAuth2

I configured the login with google in a Django project. I'm able to get the name and last name but the user is saved with an empty email. I configured the scope in this way:

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
    'profile',
    'email'
]

But the email continues saving as "". Am I writing the scopes in bad way?

Upvotes: 0

Views: 1687

Answers (1)

Dragon Ball
Dragon Ball

Reputation: 101

Try this

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

it will collect user email and profile name store it into USER model.

Upvotes: 2

Related Questions