POST /auth/webauthn/register/begin
Inicia o ceremony de registro de um passkey.
- 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`.
Inicia o ceremony de registro de um passkey.
Motivo: primeiro passo do enrollment — o RP monta as opções de creation (challenge, RP info, pubKeyCredParams, exclusions) e o browser chama navigator.credentials.create. Comportamento: (1) exige user autenticado (withAuth já verificou); (2) carrega credentials existentes pra passar em WithExclusions (impede registrar o mesmo authenticator 2x); (3) BeginRegistration da library; (4) persiste SessionData; (5) devolve challenge_id + PublicKeyCredentialCreationOptions serializado pro browser.
Entradas: request autenticado (cookie access_token); body vazio ou {"nickname": "opcional"}.
Retorno: 200 {challenge_id, publicKey: <options>}; 500 em falha library/DB; 503 se webauthn desativado. Efeito: 1 SELECT (credentials) + 1 INSERT (webauthn_challenges).
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
{challenge_id, publicKey: <options>}
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 library/DB
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
503
Se webauthn desativado. Efeito: 1 SELECT (credentials) + 1 INSERT (webauthn_challenges)
| 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/begin' \
-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/begin", {
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/begin",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={},
timeout=30,
)
res.raise_for_status()
print(res.json())