Axuz Developers

POST /auth/webauthn/login/begin

Inicia o ceremony de autenticação por passkey.

  • Access: Public
  • Service: https://auth-api.axuz.net

Accepted authentication

No authentication (public route, or protected by link/signature).

Inicia o ceremony de autenticação por passkey.

Motivo: o browser precisa saber quais credenciais permitidas (allowCredentials) pra fazer prompt certo — passamos a lista das credenciais registradas do user. Se o email não existir devolvemos um payload dummy pra evitar enumeração (mesma técnica do login por senha). Comportamento: (1) decoda {email}; (2) resolve user; (3) se o user não existe/sem credenciais devolve 200 com challenge_id "dummy" + JSON vazio — o browser vai falhar naturalmente sem revelar existência; (4) BeginLogin da library; (5) persiste SessionData; (6) devolve challenge_id + publicKey options.

Entradas: body JSON {email}. Ceremony sem cookie (login step).

Retorno: 200 sempre (mesmo em user não-existente), com payload {challenge_id, publicKey}. 400 body inválido; 503 se webauthn desativado. Efeito: leituras + 1 INSERT em webauthn_challenges (só quando user existe — path dummy não escreve).

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

Sempre (mesmo em user não-existente), com payload {challenge_id, publicKey}

400

Body inválido

NameTypeRequiredDescription
errorstringyes

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

Erro interno. Tente de novo com backoff; reporte o X-Request-Id.

NameTypeRequiredDescription
errorstringyes

503

Se webauthn desativado. Efeito: leituras + 1 INSERT em webauthn_challenges (só quando user existe — path dummy não escreve)

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/login/begin' \
  -H "Content-Type: application/json" \
  -d '{}'

Node.js

const res = await fetch("https://auth-api.axuz.net/auth/webauthn/login/begin", {
  method: 'POST',
  headers: {
    '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/login/begin",
    json={},
    timeout=30,
)
res.raise_for_status()
print(res.json())