Axuz Developers

POST /auth/webauthn/register/finish

Valida a resposta do authenticator e persiste a nova credencial em user_webauthn_credentials.

  • Access: Signed in (incl. pre-session)
  • Service: https://auth-api.axuz.net

Accepted authentication

  • sessionCookie — Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.
  • bearerSession — JWT de acesso da sessão em `Authorization: Bearer`.

Valida a resposta do authenticator e persiste a nova credencial em user_webauthn_credentials.

Motivo: fecha o enrollment — sem esse passo o passkey só existe no browser/device. A library FinishRegistration valida a assinatura do attestation, o challenge e as flags (UP/UV). Comportamento: (1) decoda body {challenge_id, nickname, credential}; (2) recupera SessionData via loadChallenge (que também DELETEa — single-use); (3) reconstrói request pra library (que espera o body bruto no r.Body — repassa via NewReader); (4) FinishRegistration; (5) INSERT em user_webauthn_credentials + UPDATE users.mfa_required_at=NULL (piso §14 — passkey satisfaz política MFA tanto quanto TOTP).

Entradas: body {challenge_id, nickname?, credential (raw JSON do authenticator)}. O credential é o output de navigator.credentials.create() serializado.

Retorno: 200 {id, nickname}; 400 body inválido / challenge inválido / FinishRegistration falha; 500 em falha DB; 503 se webauthn desativado. Efeito: 1 SELECT + 1 DELETE (challenge) + 1 INSERT (credential) + 1 UPDATE (users.mfa_required_at). Falha do UPDATE mfa é logada mas não bloqueia (compatível com o pattern do totpConfirm).

Parameters

No parameters.

Request body

Corpo JSON. O schema detalhado deste endpoint ainda não está tipado na spec; veja a descrição da operação.

application/json

NameTypeRequiredDescription
(corpo)objectno
{}

Responses

200

{id, nickname}

400

Body inválido / challenge inválido / FinishRegistration falha

NameTypeRequiredDescription
errorstringyes

401

Sem credencial valida

NameTypeRequiredDescription
errorstringyes

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

Em falha DB

NameTypeRequiredDescription
errorstringyes

503

Se webauthn desativado. Efeito: 1 SELECT + 1 DELETE (challenge) + 1 INSERT (credential) + 1 UPDATE (users.mfa_required_at). Falha do UPDATE mfa é logada mas não bloqueia (compatível com o pattern do totpConfirm)

NameTypeRequiredDescription
errorstringyes

Examples

"Try it" is turned off in this reference. Use the examples with your test credential.

curl

curl -sS -X POST 'https://auth-api.axuz.net/auth/webauthn/register/finish' \
  -H "Authorization: Bearer $AXUZ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Node.js

const res = await fetch("https://auth-api.axuz.net/auth/webauthn/register/finish", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());

Python

import os
import requests

res = requests.request(
    "POST",
    "https://auth-api.axuz.net/auth/webauthn/register/finish",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    json={},
    timeout=30,
)
res.raise_for_status()
print(res.json())