Sachin
Sachin

Reputation: 3782

How to integrate social-auth in my project

I want to use social-auth to provide registration/authentication via social network sites. I have been trying to understand how to use social-auth, but I have been unable to get beyond installing dependencies and configuring backends.

I am basically new to Django and I have tried hard to understand before posting on the forum. Maybe because I am not very familiar with it that is why I have been unsuccessful. Can anybody please point me to a tutorial on how to use social-auth. This will also help me in integrating other apps.

Update:

Although the answer given below solved my problem, I just want to share that I ended up using django-allauth instead of social-auth. And the latest version of django-allauth appears to be the best Django authentication app.

Upvotes: 10

Views: 4947

Answers (1)

Tomek Paczkowski
Tomek Paczkowski

Reputation: 574

It's somehow unclear from documentation.

You need to create apps in Twitter/Facebook/whatever you want to use.

They will give you api key and api secret.

Follow these basic steps that refer to socialauth docs:

  1. pip install
  2. add social-auth to installed apps
  3. copy AUTHENTICATION_BACKENDS
  4. fill api key and api secret
  5. add social auth url patterns
  6. configure authentication and association complete URL names (SOCIAL_AUTH_COMPLETE_URL_NAME)
  7. context processor
  8. syncdb

Now, what the documentation doesn't tell you, is to put links in your login template:

Login with <a href="{% url socialauth_begin 'twitter' %}">Twitter</a>

Should work.

Upvotes: 18

Related Questions