OAuth was actually born while writing the OpenID API for Twitter. In this recipe, we will integrate Twitter login with our application.
We will continue by building over the Using Google for authentication recipe. It is easy to just implement Twitter auth by leaving out specific parts from Facebook and/or Google authentication.
Now, we have to create an application from the Twitter Application Management page (https://apps.twitter.com/). It will automatically create API key and API secret for us to use. Have a look at the following screenshot:
As always, we will first start with the configuration part in my_app/__init__.py
:
from flask_oauth import OAuth oauth = OAuth() twitter = oauth.remote_app('twitter', base_url='https://api.twitter.com/1.1/', request_token_url='https://api.twitter.com/oauth/request_token', access_token_url='https://api.twitter.com/oauth/access_token', authorize_url='https://api.twitter.com/oauth...