v1
latestOpenAPI 3.1.02026-07-13632897.9 KBGoogle Oauth Callback
Handle Google OAuth callback.
Security (Increment 11): - Validates state exists in Redis (CSRF protection) - Retrieves user_id from Redis (not from query params) - Uses PKCE code_verifier from Redis in token exchange - State is single-use (deleted after verification) - Returns HTML error pages (user-facing redirect flow) - Never logs tokens
Args: request: FastAPI request object (provides access to app state) code: Authorization code from Google state: OAuth state token for CSRF protection error: Error code if Google authorization failed error_description: Human-readable error description session: Database session
Returns: HTML success page or HTML error page
Query parameters
Authorization code from Google
Authorization code from Google
OAuth state token for CSRF protection
OAuth state token for CSRF protection
Error code from Google
Error code from Google
Error description from Google
Error description from Google
Response
Successful Response