Follow the steps to set up Civic Auth with a FastAPI backend (a working example is available in the github repo).
http://localhost:8000
and click the login link to test authentication.
/auth/login
- starts the login process/auth/callback
- completes authentication/auth/login
- Start authentication/auth/callback
- Handle OAuth callback (auto-created)/auth/logout
- Sign out userget_current_user
dependency returns a dictionary with user information:
require_auth
dependency
get_current_user
directly
Field | Required | Description |
---|---|---|
client_id | Yes | Your Civic Auth Client ID from auth.civic.com |
redirect_url | Yes | Where Civic redirects after authentication (must be absolute URL) |
post_logout_redirect_url | Yes | Where users go after logout (must be absolute URL) |
YOUR_CLIENT_ID
with your actual client ID