Django Twitter Auth is a simple Django plugin/app to add Twitter authentication and authorization.
- Got to https://developer.twitter.com/ and create a new app if you don't already have one.
- Generate the keys and tokens and save them in config.py. CAUTION: Never add config.py to git.
- Setup the callback URL in twitter app settings and save the same in config.py.
Add "django_twitter_auth" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'django_twitter_auth', ]
Include the django_twitter_auth URLconf in your project urls.py like this:
url('twitter_oauth/', include('django_twitter_auth.urls')),
Run migrate to install the TwitterUser model that is used to store user's twitter tokens:
python manage.py migrate
Start the development server and visit http://127.0.0.1:8000/twitter_oauth/dance to get user's authorization.
Once the OAuth Dance is complete, page redirects to http://127.0.0.1:8000/twitter_oauth/confirm.