authentication
authentication
google-oauth2

Google Callback

Handle Google OAuth2 callback.

Exchanges authorization code for access token, retrieves user info, creates session, and sets HttpOnly cookie.

Args: request: FastAPI request (used for IP / User-Agent capture on the audit row written by RoleManager.ensure_user when the IdP- provided email differs from the stored value). code: OAuth2 authorization code from Google. state: CSRF state token (must match stored state).

Returns: Redirect to dashboard with session cookie set. Every failure class on this browser-facing route 303-redirects to /login with a well-known error token (#1381) — raw JSON is never the terminal state for an interactive user.

Example: GET /api/v1/auth/google/callback?code=xxx&state=yyy → Sets cookie: kagura_session=... → Redirects to /dashboard

Security: - State validation (CSRF protection) - HttpOnly cookie (XSS protection) - Secure cookie (HTTPS only) - SameSite=Lax (CSRF protection)

get/api/v1/auth/google/callback

Request

  • Base URL: https://memory.kagura-ai.com (the document declares no server; this is the origin it was published from)
  • URL: https://memory.kagura-ai.com/api/v1/auth/google/callback
  • Auth: none declared

Query parameters

codestring nullable

OAuth2 authorization code

statestring nullable

CSRF state token

errorstring nullable

OAuth2 error code (e.g. access_denied) when the user cancels

error_descriptionstring nullable

Human-readable OAuth2 error detail (not reflected)

Response

Successful Response

unknown required

Changes

No recorded changes to this operation across all 1 revision of this API.