This project has moved to a fork maintained by the Alan Turing Institute
This is a WIP and should not be used in production
Authenticate users with FastAPI using the Microsoft MSAL Library and Azure Active Directory.
To get started install Poetry.
Then ensure all dependencies are installed:
poetry install
Run to make CI-tests pass
poetry run pre-commit run --all-files
See examples/app.py for a simple example.
Create a .auth.env
file:
echo "session_expire_time_minutes=1
session_secret=<Session-Cookie-Secret>
client_id=<Application-client-id>
client_secret=<Application-Client-secret>
tenant_id=<Tenant-id" > .auth.env
For the session_secret
its a good idea to create a secret with openssl rand -hex 32
To run the example
poetry run uvicorn --reload --app-dir examples app:app --reload-dir examples