Auth API reference

Auth API · Consumer-Auth

post/{app_slug}/v1/auth/refresh

Exchange a refresh token for a new access token

Rotates the refresh token on every call — the previous refresh token is revoked, and re-using it triggers session revocation.

Path parameters

app_slug*string

Slug of the app.

Request body

refresh_token*string

Refresh token returned from signin/signup/previous refresh. Each refresh rotates the token; the previous one is revoked.

Example: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJ0eXAiOiJyZWZyZXNoIn0.c2lnbmF0dXJl"

Response · 200 A rotated access + refresh token pair.

result*object

Always `session` here: a session was minted. Discriminates the sign-in results (`session`, `mfa_required`, `mfa_enrollment_required`).

access_token*string

Short-lived JWT signed with the app-scoped JWKS key. Carries sub, role, permissions[], type=end_user.

refresh_token*string

Long-lived opaque-ish JWT used to mint a new access token via /auth/refresh. Rotated on use.

token_type*string

Always `Bearer`.

Example: "Bearer"

expires_in*number

Access-token lifetime in seconds.

Example: 3600

password_warningsarray

Non-fatal notes about the password that was just set. Present only on `signup` and `accept-invite`, and only when the app runs `password_breach_check: "warn"` and the password was found in a public breach corpus — the value is then `["breached"]` and the session is minted anyway, so the client can prompt the user to change it. The key is ABSENT (not an empty array) when there is nothing to report; do not branch on its length without checking that it exists. Apps on the default `block` never see it — a breached password is refused with 400 `PASSWORD_BREACHED`.

Example: ["breached"]

mfa_enrollment_due_atstring · date-time

Present only when the app runs `mfa: "required"`, the user holds no enabled factor, and the account is still inside `mfa_grace_days` of its creation. The session IS minted; this is the deadline after which sign-in will start returning `mfa_enrollment_required` instead, so a client can prompt rather than block. Absent in every other case.

Example

Request

POST https://api.auth.productcraft.co/{app_slug}/v1/auth/refresh
Content-Type: application/json

{
  "refresh_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJ0eXAiOiJyZWZyZXNoIn0.c2lnbmF0dXJl"
}

Response

{
  "result": {},
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "Bearer",
  "expires_in": 3600,
  "password_warnings": [
    "breached"
  ],
  "mfa_enrollment_due_at": "2026-01-01T00:00:00.000Z"
}