---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://truto.one/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Finish sign-in with a passkey second factor

> Source: https://truto.one/docs/api-reference/admin/passkeys/mfa-verify/

`POST /auth/passkey/mfa/verify`

Resource: **Passkeys**

Unauthenticated, during sign-in. Checks the assertion from `navigator.credentials.get()` against the challenge from `POST /auth/passkey/mfa/options` (spent whatever the result), requires the credential to be one of this account's, verifies it with `requireUserVerification: true`, and then finishes the sign-in as `/auth/mfa/token/verify` does: it sets the `session` cookie and spends the `mfa_token`, so a second call with it is a 400.

Send with `credentials: 'include'` so the `session` cookie is stored. The response carries no user — read `/user/me` afterwards.

An assertion that does not verify counts as a wrong two-factor answer, on the same budget as wrong codes: 5 per 15 minutes and 20 per 24 hours per account. The answer that spends the last one ends the sign-in (the `mfa_token` is spent) and answers 429.

## Request body

- **`mfa_token`** _(string)_
  The `mfa_token` from the sign-in that answered `mfa_required`.
- **`response`** _(object, required)_
  The `PublicKeyCredential` returned by `navigator.credentials.get()`, JSON-serialized (base64url). Extra fields the browser adds are accepted and ignored.
  - **`id`** _(string)_
    base64url credential ID. Max 64 KB.
  - **`rawId`** _(string)_
    base64url credential ID. Max 64 KB.
  - **`type`** _(string)_
    Always `public-key`. Max 64 characters.
  - **`response`** _(object, required)_
    - **`clientDataJSON`** _(string)_
      base64url. Max 64 KB.
    - **`authenticatorData`** _(string)_
      base64url. Max 64 KB.
    - **`signature`** _(string)_
      base64url. Max 64 KB.
    - **`userHandle`** _(string)_
      base64url. Max 64 KB. Ignored — the credential ID resolves the user.

## Response body

- **`success`** _(boolean)_

## Errors

| Status | Description |
| :----- | :---------- |
| `400` | Missing, expired, used or wrong-purpose `mfa_token`; the passkey could not be verified (no live challenge for what it signed, not this account's credential, bad signature, user verification absent); unknown body keys; or a body that is not JSON. |
| `403` | The account is turned off. |
| `404` | Passkeys are not enabled for this environment, or a passkey does not count as a second factor here yet (`PASSKEY_MFA` is off). |
| `429` | Too many wrong two-factor answers for this account, or too many calls. |

## Code examples

### curl

```bash
curl -X POST 'https://api.truto.one/auth/passkey/mfa/verify' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "mfa_token": "your_mfa_token",
  "response": {}
}'
```

### JavaScript

```javascript
const body = {
  "mfa_token": "your_mfa_token",
  "response": {}
};

const response = await fetch('https://api.truto.one/auth/passkey/mfa/verify', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/auth/passkey/mfa/verify"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "mfa_token": "your_mfa_token",
    "response": {}
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
```
