Platform API reference

Platform API · Authentication

post/v1/auth/mfa/verify

Finish sign-in with the second step

Send exactly one of `{factor_id, code}` (authenticator app or email), `{recovery_code}` or `{factor_id, webauthn}`. A right answer returns the session tokens, exactly like a sign-in without two-step. A wrong one spends one of the challenge's 5 tries. Not idempotent: the answer is a session.

Request body

mfa_token*string

`mfa_token` from the sign-in answer.

factor_idstring · uuid

The factor answered (TOTP, email or passkey). Omit with `recovery_code`.

codestring

6-digit TOTP or email code.

recovery_codestring

A recovery code (`abcd-efgh-jk`, case-insensitive, dashes optional). Works once.

webauthnobject

The `PublicKeyCredential` from `navigator.credentials.get()`, ArrayBuffers base64url-encoded: `{ id, raw_id, type: "public-key", response: { clientDataJSON, authenticatorData, signature, userHandle } }`. WebAuthn member names are passed through verbatim (camelCase by spec).

Response · 200

access_token*string

Access token (JWT)

Example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

refresh_tokenstring

Refresh token (JWT)

Example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

token_type*string

Token type

Example: "Bearer"

expires_in*number

Access token TTL in seconds

Example: 3600

Example

Request

POST https://api.platform-auth.productcraft.co/v1/auth/mfa/verify
Content-Type: application/json

{
  "mfa_token": "string",
  "factor_id": "00000000-0000-0000-0000-000000000000",
  "code": "string",
  "recovery_code": "string",
  "webauthn": {}
}

Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600
}