Follow these simple steps to set up Civic Auth with a Flask backend (a working example is available in the github repo).
redirect_url
and post_logout_redirect_url
must be absolute URLs.
/auth/login
- Initiates the login flow/auth/callback
- Handles the OAuth callback/auth/logout
- Logs the user outcivic_auth_required
decorator to protect routes:
get_civic_user()
to access the logged-in user as a dictionary:
get_civic_user()
function returns a dictionary with user information. Always use .get()
for safe access:
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) |
redirect_url
and post_logout_redirect_url
must be absolute URLs.YOUR_CLIENT_ID
with your actual client ID.get()
method for dictionary access