POST /auth/webauthn/register/begin
Inicia o ceremony de registro de um passkey.
- 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`.
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).
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
| Name | Type | Required | Description |
|---|---|---|---|
(corpo) | object | no |
{}Responses
200
{challenge_id, publicKey: <options>}
401
Sem credencial valida
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
429
Limite de requisições excedido.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
500
Em falha library/DB
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
503
Se webauthn desativado. Efeito: 1 SELECT (credentials) + 1 INSERT (webauthn_challenges)
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
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/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())