FastAPI backend with users and relationships
Web applications (or mobile apps, for that matter) are not very useful if they are not secure – we keep hearing about tiny errors in the authentication implementations that ended up with hundreds of thousands or even millions of compromised accounts that might include sensitive and valuable information.
FastAPI is based on OpenAPI – previously known as Swagger – an open specification for crafting APIs. As such, OpenAPI enables us to define various security schemes, compatible with the various protocols (apiKey
, http
, oauth2
, openIdConnect
, and so on). While the FastAPI documentation website provides an excellent and detailed tutorial on creating an authentication flow, it is based on the oauth2
protocol, which uses form data for sending the credentials (username and password).
There are literally dozens of ways you could implement some type of security for your API, but what I really want to accomplish in this...