Authentication failed: Include valid openId scopes like profile, email

135 Views Asked by At

I am building an app with Django and social-auth-app-django.

I followed this tutorial.

I created an app on LinkedIn for Developers, got the client_id and secret_key. I also made sure that the product Sign In with LinkedIn using OpenID Connect is added to my app.

In settings.py, I added all the OAUTH2 parameters:

SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = '...'  # Client ID
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = '...'  # Client Secret
SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE =  ['r_basicprofile', 'r_emailaddress']
SOCIAL_AUTH_LINKEDIN_OAUTH2_FIELD_SELECTORS = ['email',
                                               'formatted-name',
                                               'public-profile-url',
                                               'picture-url']
SOCIAL_AUTH_LINKEDIN_OAUTH2_EXTRA_DATA = [
    ('id', 'id'),
    ('formattedName', 'name'),
    ('emailAddress', 'email_address'),
    ('pictureUrl', 'picture_url'),
    ('publicProfileUrl', 'profile_url'),
]

However, I kept getting Authentication failed: Scope "r_basicprofile" is not authorized for your application.

I changed SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE:

SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE =  ['openid']

Now I get Authentication failed: Include valid openId scopes like profile, email.

Based on the official LinkedIn documentation, I also tried

SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE = ['openid', 'profile', 'email']

But I got Authentication failed: Scope "r_liteprofile" is not authorized for your application. again.

Has anyone an example of a settings.py configuration that works?

0

There are 0 best solutions below