-
Book Overview & Buying
-
Table Of Contents
Flask Framework Cookbook - Third Edition
By :
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 implement Twitter authentication – simply leave out the Facebook or Google-specific parts from the previous authentication recipes.
First, we have to create an application from the Twitter Application Management page (https://developer.twitter.com/en/portal/dashboard). It will automatically create consumer API keys (API Key and API Key Secret) for us to use, as shown in the following screenshot:
Figure 6.10 – Twitter app configuration
To enable Twitter authentication for your application, follow these steps:
my_app/__init__.py, as follows:app.config["TWITTER_OAUTH_CLIENT_KEY"] = ...