Lesson 4B

Single-sign on with Microsoft and Google

Share Tweet

Contents

The objective of this lesson is to present how to implement the single-sign on (SSO) based on third-party services such as Microsoft and Google. By integrating the SSO, the application will allow users to be able to authenticate by using their Microsoft or Google account. The SSO also enhance the user experience with your application since the users do not need to create an account on your application. This lesson will be organized into two topics:

  • Implement the SSO based on Microsoft via Microsoft Graph
  • Implement the SSO based on GitHub and OAuthLib
  • In Lesson 3B, we introduced how to integrate Gmail API to your application. Based on that lesson, you will extend its functionality to implement the SSO based on Google. Besides the google-api-python-client , you can use the OAuthLib instead which is a popular implementation of the OAuth request-signing logic for Python 3.6+.


Exercises

Ex.1 — In this exercise, you will integrate the SSO based on Microsoft and Google to your current demo application, i.e., the social blogging application.

Ex.2 — After completing Ex.1, your application will have three options for authentication, i.e., your own authentication mechanism, via Microsoft, and via Google. In this exercise, you need to integrate another third-party SSO services such as Facebook, GitHub, LinkedIn, Pinterest, Yahoo. Instead of independently integrating each SSO-based library to your project, you should use the Python Social Auth extension to generalize the implementation.


Further Reading

  1. Create a Flask Application With Google Login
  2. [GitHub] Single Sign-on with Microsoft Graph API
  3. Microsoft Graph — Send Mail API

Next Lesson

In most applications, users need to be assigned to the predefined roles/permissions such as normal user, moderator, administrator when using the application. A more complex application may need additional roles than normal and administrator roles. In this case, we need to clarify the Roles and Permissions terminologies. In the next lesson, we will discuss how to implement and manage the User Roles within your application.

Lesson 4C: A Social Blogging Application - Part 2: User Roles


Relaxing 🧘