POST /oauth/consent
Decisão do usuário (aprovar/negar)
- Acesso: Pública
- 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.
Exige sessão plena e Origin confiável (CSRF). Aprovar grava o consentimento, cria o grant e o código (60 s, uso único) e devolve o redirect_to (a redirect_uri com code/state/iss). Negar devolve redirect_to com error=access_denied.
Parâmetros
Sem parâmetros.
Corpo da requisição
application/json · Obrigatório
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
client_id | string | sim | |
redirect_uri | string | sim | |
scope | string | sim | |
state | string | sim | |
nonce | string | não | |
code_challenge | string | sim | |
code_challenge_method | string | sim | enum: |
approve | boolean | sim |
{
"client_id": "string",
"redirect_uri": "string",
"scope": "string",
"state": "string",
"nonce": "string",
"code_challenge": "string",
"code_challenge_method": "S256",
"approve": true
}Respostas
200
Destino da navegação.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
redirect_to | string<uri> | sim |
400
Erro do protocolo (RFC 6749 §5.2).
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type, invalid_scope, invalid_token, insufficient_scope, access_denied, login_required, consent_required, enrollment_required, rate_limited, not_found, server_error. |
error_description | string | não |
401
Sem sessão válida.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type, invalid_scope, invalid_token, insufficient_scope, access_denied, login_required, consent_required, enrollment_required, rate_limited, not_found, server_error. |
error_description | string | não |
403
Sessão restrita (menos de 2 fatores fortes). Cadastre fatores primeiro.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type, invalid_scope, invalid_token, insufficient_scope, access_denied, login_required, consent_required, enrollment_required, rate_limited, not_found, server_error. |
error_description | string | não |
429
Limite de requisições excedido.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| 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/oauth/consent' \
-H "Cookie: access_token=$AXUZ_SESSION_JWT" \
-H "Content-Type: application/json" \
-d '{"client_id":"string","redirect_uri":"string","scope":"string","state":"string","nonce":"string","code_challenge":"string","code_challenge_method":"S256","approve":true}'Node.js
const res = await fetch("https://auth-api.axuz.net/oauth/consent", {
method: 'POST',
headers: {
Cookie: `access_token=${process.env.AXUZ_SESSION_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"client_id": "string",
"redirect_uri": "string",
"scope": "string",
"state": "string",
"nonce": "string",
"code_challenge": "string",
"code_challenge_method": "S256",
"approve": true
}),
});
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/oauth/consent",
headers={
"Cookie": f"access_token={os.environ['AXUZ_SESSION_JWT']}",
},
json={
"client_id": "string",
"redirect_uri": "string",
"scope": "string",
"state": "string",
"nonce": "string",
"code_challenge": "string",
"code_challenge_method": "S256",
"approve": True,
},
timeout=30,
)
res.raise_for_status()
print(res.json())