Django-allauth: Linkedin_oauth2 HTTPError('410 Client Error: Gone for url:

Created on 28 Mar 2019  路  4Comments  路  Source: pennersr/django-allauth

I get the following error when I try to use linkedin authentication:

An error occurred while attempting to login via your social network account.
{'provider': 'linkedin_oauth2', 'code': 'unknown', 'exception': HTTPError('410 Client Error: Gone for url: https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,public-profile-url)?format=json')}

My settings.py file has the following for linkedin:

INSTALLED_APPS = [
'home.apps.HomeConfig',
'blot.apps.BlotConfig',
'scholarship.apps.ScholarshipConfig',
'school.apps.SchoolConfig',
'users.apps.UsersConfig',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'django.contrib.humanize',
'django.contrib.sites',
'widget_tweaks',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.linkedin_oauth2',
'allauth.socialaccount.providers.twitter',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'modelcluster',
'taggit',
'django_social_share',
]

SOCIALACCOUNT_PROVIDERS = {
'linkedin_oauth2': {
'SCOPE': [
'r_liteprofile',
'r_emailaddress'
],
'PROFILE_FIELDS': [
'id',
'first-name',
'last-name',
'email-address',
'picture-url',
'public-profile-url',
]
}

Most helpful comment

Actually, I'm still encountering the client gone error when I use linkedin_oauth2 as my SOCIALACCOUNT_PROVIDERS key. If SOCIAL_ACCOUNT_PROVIDERS is set to linkedin, and installed apps is set to allauth.socialaccount.providers.linkedin_oauth2, I can register with linkedin successfully.

Working configuration:

django-all-auth version: 3.9.1

INSTALLED_APPS = [
    ... 
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    ...
    'allauth.socialaccount.providers.linkedin_oauth2'
]

SOCIALACCOUNT_PROVIDERS = {
    'linkedin': {
        'SCOPE': [
            'r_emailaddress',
            'r_basicprofile',
        ],
        'PROFILE_FIELDS': [
            'id',
            'first-name',
            'last-name',
            'email-address',
            'picture-url',
            'public-profile-url',
        ]
    }
}

All 4 comments

I just ran into this as well. It looks like the issue is related to all-auth 3.8 is using the linkedin v1 api endpoint, ie https://api.linkedin.com/v1/people/.
This appears to be fixed in 3.9.1 (which hasn't had a full release yet according to the docs).

Actually, I'm still encountering the client gone error when I use linkedin_oauth2 as my SOCIALACCOUNT_PROVIDERS key. If SOCIAL_ACCOUNT_PROVIDERS is set to linkedin, and installed apps is set to allauth.socialaccount.providers.linkedin_oauth2, I can register with linkedin successfully.

Working configuration:

django-all-auth version: 3.9.1

INSTALLED_APPS = [
    ... 
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    ...
    'allauth.socialaccount.providers.linkedin_oauth2'
]

SOCIALACCOUNT_PROVIDERS = {
    'linkedin': {
        'SCOPE': [
            'r_emailaddress',
            'r_basicprofile',
        ],
        'PROFILE_FIELDS': [
            'id',
            'first-name',
            'last-name',
            'email-address',
            'picture-url',
            'public-profile-url',
        ]
    }
}

The linkedin_oauth2 providrr has the id "linkedin_oauth2":

image

So, allauth really is not picking up any settings from the SOCIALACCOUNT_PROVIDERS['linkedin'] dict. So, the only think you achieved by configuring it that way is to use the default builtin settings.

Will have to close this, see https://django-allauth.readthedocs.io/en/latest/faq.html#why-did-you-just-close-my-issue

Was this page helpful?
0 / 5 - 0 ratings