chain-rdeveloper portal
build

svc-auth — API Routes

Auto-generated from source on 2026-10-30 15:00 UTC. Do not edit manually — run make spec to regenerate.


/

Source: modules/svc-auth/main.py

MethodPathHandlerDescription
GET/loginloginInitiate OAuth login flow.
GET/callbackcallbackHandle OAuth callback from Auth0.
GET/verifyverify_sessionVerify session and return user info.
GET/logoutlogoutLogout user and clear session.
POST/logoutlogoutLogout user and clear session.
GET/meget_user_infoGet current authenticated user information.
GET/sessionslist_sessionsList the caller's currently-active sessions for the account UI.
GET/sessions/historylist_session_historyReturn a page of the caller's ended sessions, most-recently-ended first.
POST/sessions/{session_id}/revokerevoke_sessionRevoke one of the caller's sessions by its UUID.
DELETE/sessions/{session_id}revoke_sessionRevoke one of the caller's sessions by its UUID.
POST/sessions/revoke-othersrevoke_other_sessionsSign out everywhere except the caller's current session.
GET/session/infoget_session_infoGet session information (for debugging in development).

GET /health

Health check endpoint.

Returns service health and Redis connectivity status.

GET /login

Initiate OAuth login flow.

Query Parameters: return_to: URL to redirect to after successful authentication

Flow:

  1. Generate state and nonce for CSRF protection

  2. Store OAuth state in temporary Redis session

  3. Redirect to Auth0 authorization endpoint

GET /callback

Handle OAuth callback from Auth0.

Query Parameters: code: Authorization code from Auth0 state: State parameter for CSRF validation error: Error code if authentication failed

Flow:

  1. Validate state parameter against stored value

  2. Exchange authorization code for tokens

  3. Extract user info from ID token

  4. Create session and store tokens server-side

  5. Redirect to application with session cookie

GET /verify

Verify session and return user info.

Used by nginx auth_request directive to protect routes.

Headers: X-User-Id: User identifier X-Session-Id: Session identifier

Returns: 200: Session valid 401: Session invalid or expired

GET /logout

Logout user and clear session.

Flow:

  1. Delete session and tokens from Redis

  2. Clear session cookie

  3. Redirect to Auth0 logout endpoint

POST /logout

Logout user and clear session.

Flow:

  1. Delete session and tokens from Redis

  2. Clear session cookie

  3. Redirect to Auth0 logout endpoint

GET /me

Get current authenticated user information.

Returns: User profile data from ID token

Raises: 401: Not authenticated

GET /sessions

List the caller's currently-active sessions for the account UI.

Reconciles state on read: any session still marked active whose Redis key has vanished (idle TTL lapse) is flagged expired and dropped from the response — it surfaces under `/sessions/history` instead. The opaque session token is never included; sessions are addressed by their UUID.

GET /sessions/history

Return a page of the caller's ended sessions, most-recently-ended first.

Covers logged-out, revoked, and expired sessions. `limit is clamped to [1, 100] and offset` to >= 0 to bound the query. The response carries the total ended count so the UI can drive "load more" / pagination.

POST /sessions/{session_id}/revoke

Revoke one of the caller's sessions by its UUID.

Ends the durable record and deletes the matching Redis session/tokens so the next /verify on that session fails. Only the owner may revoke.

Exposed as both `POST /sessions/{id}/revoke and DELETE /sessions/{id}`. The browser uses POST: edge proxies / WAFs (Cloudflare) in front of the deployment frequently block the DELETE method outright (returning 403), so the safe-everywhere mutation verb is POST. DELETE is retained for API clients / backward compatibility.

DELETE /sessions/{session_id}

Revoke one of the caller's sessions by its UUID.

Ends the durable record and deletes the matching Redis session/tokens so the next /verify on that session fails. Only the owner may revoke.

Exposed as both `POST /sessions/{id}/revoke and DELETE /sessions/{id}`. The browser uses POST: edge proxies / WAFs (Cloudflare) in front of the deployment frequently block the DELETE method outright (returning 403), so the safe-everywhere mutation verb is POST. DELETE is retained for API clients / backward compatibility.

GET /session/info

Get session information (for debugging in development).

Only available in development mode.