Skip to content

Commit e6c5be4

Browse files
committed
Updated index.rst with twitter login
1 parent 1af16ae commit e6c5be4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/installation.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Using ``django-allauth``, ``django-rest-auth`` provides helpful class for creati
8585
...,
8686
'allauth.socialaccount',
8787
'allauth.socialaccount.providers.facebook',
88+
'allauth.socialaccount.providers.twitter',
89+
8890
)
8991
9092
2. Add Social Application in django admin panel
@@ -108,4 +110,20 @@ Using ``django-allauth``, ``django-rest-auth`` provides helpful class for creati
108110
url(r'^rest-auth/facebook/$', FacebookLogin.as_view(), name='fb_login')
109111
)
110112
113+
5. If you are using Twitter for your social authentication, it is a bit different from
114+
Facebook since Twitter uses OAuth 1.0.
115+
116+
117+
6. Create new view as a subclass of ``rest_auth.views.LoginView`` with ``TwitterOAuthAdapter`` adapter and ``TwitterLoginSerializer`` as an attribute:
118+
119+
.. code-block:: python
120+
121+
from allauth.socialaccount.providers.twitter.views import TwitterOAuthAdapter
122+
from rest_auth.views import LoginView
123+
from rest_auth.social_serializers import TwitterLoginSerializer
124+
125+
class TwitterLogin(LoginView):
126+
serializer_class = TwitterLoginSerializer
127+
adapter_class = TwitterOAuthAdapter
128+
111129
.. note:: Starting from v0.21.0, django-allauth has dropped support for context processors. Check out http://django-allauth.readthedocs.org/en/latest/changelog.html#from-0-21-0 for more details.

0 commit comments

Comments
 (0)