Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.55 KB

README.md

File metadata and controls

40 lines (28 loc) · 1.55 KB

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