alexykot
alexykot

Reputation: 719

django-social-auth backend not found

I'm trying to add authentication with Twitter, GitHub, Google and Facebook using django-social-auth, and the backends I expect to be there are not available.

Installed it according to manual:

AUTHENTICATION_BACKENDS = (
    'social_auth.backends.twitter.TwitterBackend',
    'social_auth.backends.contrib.github.GithubBackend',
    'social_auth.backends.facebook.FacebookBackend',
    'social_auth.backends.google.GoogleOAuthBackend',
    'social_auth.backends.google.GoogleOAuth2Backend',
    'social_auth.backends.google.GoogleBackend',
    # ....unnecessary backends

    'guardian.backends.ObjectPermissionBackend',
    'django.contrib.auth.backends.ModelBackend',
)

TWITTER_CONSUMER_KEY         = ''
TWITTER_CONSUMER_SECRET      = ''
FACEBOOK_APP_ID = ''
FACEBOOK_APP_SECRET = ''
GOOGLE_CONSUMER_KEY          = ''
GOOGLE_CONSUMER_SECRET       = ''
GOOGLE_OAUTH2_CLIENT_ID      = ''
GOOGLE_OAUTH2_CLIENT_SECRET  = ''

LOGIN_URL          = '/login/'
LOGIN_REDIRECT_URL = '/'
LOGIN_ERROR_URL    = '/login/'

SOCIAL_AUTH_FORCE_POST_DISCONNECT = True
SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ['next',]

Added URLs in template: {% url socialauth_begin 'twitter' %}, {% url socialauth_begin 'github' %} etc, all fine until here.

But when I click the link - it gives me error: Incorrect authentication service "twitter"

As per manual I've checked contents of social_auth.backends.BACKENDS and it has only this: {'openid': <class 'social_auth.backends.OpenIdAuth'>}

Why backends I've enabled are not there and why there is a backend that I've actually not enabled?

PS: python 2.7.3, django 1.4.5, django-social-auth 0.7.19

Upvotes: 1

Views: 4514

Answers (1)

alexykot
alexykot

Reputation: 719

If somebody will bump into this error message same silly way as I did. You just need the KEY and SECRET from the auth provider, twitter, google etc. It doesn't say a thing about that in the error message, but that's why it's failing.

Upvotes: 6

Related Questions