POST /auth/webauthn/register/finish
Valida a resposta do authenticator e persiste a nova credencial em user_webauthn_credentials.
- Acesso: Login (inclui pré-sessão)
- Serviço:
https://auth-api.axuz.net
Autenticação aceita
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).
Parâmetros
Sem parâmetros.
Corpo da requisição
Corpo JSON. O schema detalhado deste endpoint ainda não está tipado na spec; veja a descrição da operação.
application/json
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
(corpo) | object | não |
{}Respostas
200
{id, nickname}
400
Body inválido / challenge inválido / FinishRegistration falha
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
401
Sem credencial valida
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
429
Limite de requisições excedido.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
500
Em falha DB
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
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)
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
Exemplos
O "Try it" está desligado nesta referência. Use os exemplos com a sua credencial de teste.
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())