Skip to content

OIDC Login

hzel uses OpenID Connect (OIDC) for browser-based authentication. The identity provider is https://i.hzel.org. All flow endpoints are served from https://api.hzel.org.

Browser → GET https://api.hzel.org/api/v1/auth/oidc/authorize
← 302 redirect to https://i.hzel.org/authorize?…
https://i.hzel.org authenticates the user
→ GET https://api.hzel.org/api/v1/auth/oidc/callback?code=…&state=…
Backend validates code and state, issues JWTs
← 302 redirect to dashboard callback URL

Redirects the browser to https://i.hzel.org to begin the OIDC flow. Sets a CSRF state cookie before redirecting.

HeaderValueRequired

No headers or body required. Visited directly by the browser.

Response: 302 Foundhttps://i.hzel.org/authorize?client_id=…&state=…


Receives the authorization code from https://i.hzel.org, validates the state against the session cookie, exchanges the code for JWTs, and redirects the browser to the dashboard.

Query Parameters

ParameterTypeRequiredDescription
codestringYesAuthorization code from https://i.hzel.org
statestringYesCSRF state token set during the authorize redirect

Response: 302 Found → dashboard callback URL.

Errors

Statuserror.codeReason
400BAD_REQUESTMissing code or state parameter
403FORBIDDENstate does not match the session cookie

Exchanges a valid refresh JWT for a new access/refresh token pair. Tokens rotate on each use.

HeaderValueRequired
Content-Typeapplication/jsonYes

Request Body

FieldTypeRequiredDescription
refresh_tokenstringYesThe refresh JWT from the previous token response

Success 200

{
"data": {
"access_token": "eyJ…",
"refresh_token": "eyJ…",
"token_type": "Bearer",
"expires_in": 900
}
}

Errors

Statuserror.codeReason
401UNAUTHORIZEDToken missing, expired, or revoked

Returns the authenticated user’s profile and CSRF token. Use the csrf_token in the x-csrf-token header for all browser-session mutating requests.

HeaderValueRequired
AuthorizationBearer <access_token>One of these two
Cookiesession=<value>One of these two

Success 200

{
"data": {
"user": { "user_id": "01942cf7-…", "email": "user@example.com", "role": "user" },
"session": {
"session_id": "",
"csrf_token": "3f2a1b4c-…",
"expires_at": "2026-03-28T10:00:00Z",
"auth_method": "Oidc"
}
}
}

Errors

Statuserror.codeReason
401UNAUTHORIZEDNo valid session or token