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 ...

Get Flask Framework Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.