Auth API reference

Auth API · Consumer-Auth

post/{app_slug}/v1/auth/mfa/recover

Complete an MFA challenge with a recovery code

Same flow as `/auth/mfa/verify` but consumes a single-use recovery code (16 hex chars; hyphens optional). Mints tokens with `amr: ["pwd","recovery_code"]`. After successful recovery, the user should regenerate their recovery codes via `/me/mfa/recovery-codes/regenerate`.

Path parameters

app_slug*string

Slug of the app.

Request body

mfa_token*string

The `mfa_token` returned by `/auth/signin`. UUID.

Example: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f"

recovery_code*string

A single-use recovery code (16 hex chars, hyphens optional). Consumes the code on success — the user should regenerate the set afterwards via `/me/mfa/recovery-codes/regenerate`.

Example: "1a2b-3c4d-5e6f-7890"

Response · 200 Recovery code accepted; session + tokens minted with `amr: ["pwd","recovery_code"]`.

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/mfa/recover
Content-Type: application/json

{
  "mfa_token": "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
  "recovery_code": "1a2b-3c4d-5e6f-7890"
}

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"
}