Using Facebook for authentication
We have seen that many websites provide an option to log in to their website using third-party authentications such as Facebook, Google, Twitter, LinkedIn, and so on. This has been made possible by OAuth, which is an open standard for authorization. It allows the client site to use an access token to access the protected information/resources provided by the resource server. In this recipe, we will see how to implement OAuth-based authorization via Facebook. In the recipes to follow, we will do the same using other providers.
Getting started
First, we will start by installing the Flask-OAuth extension and its dependencies:
$ pip install Flask-OAuth
Next, we have to register for a Facebook application that will be used for login. Although the process for registration with the Facebook app is pretty straightforward and self-explanatory, we are only concerned with the App ID, App Secret, and Site URL options. The following screenshot should help you in understanding...