Social login

In my last articles (FastAPI — How to add basic and cookie authentication and FastAPI authentication revisited: Enabling API key authentication) I wrote about implementing two kinds of authentication (Basic and API) for FastAPI, which are ‘local’ authentication options. With ‘local’ authentication I mean that a username/password or API key are checked with FastAPI without using an external authentication provider.

This article will cover the case of connecting to an external authentication provider, in this case, Google. With this set-up, you are able to give Google users access to the API. The example code can be leveraged to include other…


Intro

So, in my last article, I wrote about adding Basic Authentication to the example tutorial app, which is based on the excellent work of Sebastián Ramírez of the FastAPI framework.

Now I am exploring a new type of authentication, API key-based authentication. This is authentication in the form of an arbitrary string with an arbitrary length, which gives access to an API.

For the API it would be great if it supports API key validation by:

  1. Checking for a query parameter containing the API key
  2. Checking for a header containing the API key
  3. Checking for a cookie containing the API…


Background

In my work as a Data Rebel, I encounter many challenges to help unlock, enrich and use data to help our customers. In the last couple of years, I have come to the conclusion that at this moment in time, the best way to scale and provide data-driven solutions is by creating API’s. These API’s can be used and consumed by your own API’s our by other consumers like for example a customer-faced website.

As our team makes use of Python in almost all cases, finding the right library can significantly speed up the development process. At this moment…

Nils de Bruin

Creative Data Rebel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store