Auth API reference

Auth API · Consumer-Auth

post/{app_slug}/v1/auth/email/verify

Finish a passwordless email sign-in with the code or the link

Send `flow_id` + `code`, or the link's `token` (+ `flow_id` when the app keeps links to the browser that asked, the default). Creates the account when the address had none and the flow allowed sign-up; the email is marked verified either way. Returns the same results as `/auth/signin`: a session (`amr: ["email","otp"]` for a code, `["email","link"]` for a link), an MFA challenge when the person holds a factor, or an enrolment demand when the app requires MFA. With `response_mode: "redirect"` (hosted pages) the result goes behind a `heimdall_code` and the response is `{ redirect_url }` instead. A flow dies after 5 wrong codes. Every failure is the same 401, so a wrong code, an unknown, used or expired flow and one that was never emailed look alike.

Path parameters

app_slug*string

Slug of the app.

Request body

flow_idstring

The `flow_id` from `/auth/email/start`. Required with `code`. With `token`, required when the app keeps links to the browser that asked (`require_same_browser`, the default).

codestring

The 6-digit code from the email. Send this or `token`.

Example: "482913"

tokenstring

The `token` query parameter the magic link opened your page with. Send this or `code`.

response_modeobject

`tokens` (default) returns the sign-in result. `redirect` is for hosted pages: the result is put behind a single-use 60-second `heimdall_code` and the response is `{ redirect_url }`, the flow's `return_to` with the code appended. Needs a flow started with `return_to`.

Response · 200 A sign-in result (branch on `result`), or `{ redirect_url }` in redirect mode.

object

Example

Request

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

{
  "flow_id": "string",
  "code": "482913",
  "token": "string",
  "response_mode": {}
}

Response

{}