Auth Flow Visualizer
Interactive diagrams showing how authentication flows work in Aero2.
Authorization Code Flow
The standard flow for authenticating users in your application:
Browser
Your App
Aero2
- 1Browser → Your AppUser clicks Login
- 2Your AppGenerate PKCE code_verifier + code_challengecrypto.getRandomValues() + SHA-256
- 3Your App → Aero2Redirect to /oauth2/authorize?client_id=...&redirect_uri=...&code_challenge=...&code_challenge_method=S256&response_type=code&scope=openid+profile+email
- 4Aero2 → BrowserShow login pageUser authenticates with identity provider
- 5Aero2 → Your AppRedirect to redirect_uri with code?code=abc123&state=xyz
- 6Your App → Aero2Exchange code for tokensPOST /oauth2/token grant_type=authorization_code&code=...&code_verifier=...
- 7Aero2 → Your AppReturn access_token, id_token, refresh_tokenRS256-signed JWTs
- 8Your App → Aero2Fetch user info (optional)GET /oauth2/userinfo Authorization: Bearer <access_token>
Relying Party Flow
How Aero2 delegates authentication to external providers (GitHub, Google, etc.):
Browser
Aero2
External IdP
- 1Browser → Aero2User clicks Login with GitHubGET /rp/authorize?idp=github&redirect_uri=/dashboard
- 2Aero2Generate state, store in DB10-minute expiry, set HttpOnly cookie
- 3Aero2 → External IdPRedirect to GitHub authorize URL?client_id=...&redirect_uri=/rp/callback/github&state=...
- 4External IdP → BrowserUser authenticates with GitHub
- 5External IdP → Aero2Redirect back with codeGET /rp/callback/github?code=...&state=...
- 6Aero2Validate state (cookie + DB)Atomic DELETE with RETURNING prevents replay
- 7Aero2 → External IdPExchange code for access tokenPOST to GitHub token endpoint
- 8Aero2 → External IdPFetch user info from GitHubGET /user with access token
- 9Aero2Create/link local user, create session
- 10Aero2 → BrowserSet session cookie, redirect to dashboardHttpOnly, Secure, SameSite=Lax
Refresh Token Flow
How your application obtains new access tokens using a refresh token:
Your App
Aero2
- 1Your AppAccess token expires1-hour lifetime
- 2Your App → Aero2Request new tokensPOST /oauth2/token grant_type=refresh_token&refresh_token=...
- 3Aero2Validate and rotate refresh tokenOld token invalidated, new token issued
- 4Aero2 → Your AppReturn new access_token + refresh_tokenNew refresh token replaces the old one
See Also
- How Authentication Works — High-level overview
- Authorization Code + PKCE — Detailed flow walkthrough
- RP vs Provider — When Aero2 uses each role