Skip to content

SogoKato/oidc-fastapi-authlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oidc-fastapi-authlib

Sample implementation for OIDC with FastAPI and Authlib.

About

This is a sample implementation for OpenID Connect with Python, FastAPI and Authlib.

overview

It uses...

  • Authorization Code Flow
  • Cookie to store ID token
    • HttpOnly: true, SameSite: Lax, Secure: true
  • nginx for path routing
    architecture

Related post (Japanese): よくあるSPA+API構成でのOpenID Connectクライアント実装

Getting Started

Prerequisites

  • docker / docker compose
  • Some OpenID Provider
    • Set Redirect URI (Allowed Callback URLs) as http://localhost:8080/api/auth

Fill .env with each value below.

  • Client ID
  • Client Secret
  • OpenID Configuration Endpoint

Run

docker compose build
docker compose up

Open http://localhost:8080/ in your browser and try it out!

Log in

About

Sample implementation for OIDC with FastAPI and Authlib.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published