9

I am trying to incorporate linkedin oauth2 in my app using python-social-auth. However, when i navigate to 127.0.0.1:8000/login/linkedin/ in Chrome I get a "Backend not found" error. Specifically, the logs display the following errors:

[08/Sep/2014 16:44:38] "GET /login/linkedin HTTP/1.1" 301 0
[08/Sep/2014 16:44:38] "GET /login/linkedin/ HTTP/1.1" 404 1608

I have the following related code in my settings.py:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'github_app',
    'tech_seeker',
    'social.apps.django_app.default'
)

SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = "<MY_KEY_HERE>"
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = "<MY_SECRET_HERE>"

SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'

AUTHENTICATION_BACKENDS = (
    'social.backends.linkedin.LinkedinOAuth2',
    'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'github_app.auth_pipeline.user'
)

Any help is appreciated.

i_trope
  • 1,554
  • 2
  • 22
  • 42
  • 2
    If you are using ``social.backends.linkedin.LinkedinOAuth2``the url must be ``http://localhost:8000/login/linkedin-oauth2/``: ``Login`` For ``social.backends.linkedin.LinkedinOAuth`` it's ``http://localhost:8000/login/linkedin/``: ``Login`` – cansadadeserfeliz Sep 08 '14 at 21:09
  • I am also having the same problem. please help me if you have got the solution – Nidhi Sep 11 '14 at 08:35

1 Answers1

11

Because you use OAUTH2 you need to change you url for using oauth2.

<a href="{% url 'social:begin' backend='linkedin-oauth2' %}">LinkedIn</a>
Sergey Lyapustin
  • 1,917
  • 17
  • 27
  • 1
    There's [a list of backends here](http://psa.matiasaguirre.net/docs/backends/), a few examples of the [django apps here](http://psa.matiasaguirre.net/docs/configuration/django.html#authentication-backends), but is there a complete list of backends and url names somewhere or a way to work it out? – jozxyqk Jun 28 '15 at 04:03
  • 1
    No, you can only look inside every backend at https://github.com/omab/python-social-auth/blob/master/social/backends/ for "name" value – Sergey Lyapustin Jun 29 '15 at 10:16
  • 1
    Thanks, I found the documentation to be really lacking here. – antonagestam Jul 24 '15 at 11:04