GET /auth/oauth/{provider}/start
Inicia o fluxo OAuth redirecionando pro provider.
- Access: Public
- Service:
https://auth-api.axuz.net
Accepted authentication
No authentication (public route, or protected by link/signature).
Inicia o fluxo OAuth redirecionando pro provider.
Motivo: entrypoint quando o usuário clica "Sign in with Google/GitHub"; gera state assinado com next embutido pra proteger contra CSRF + open redirect no callback. Comportamento: resolve Provider; se nulo ou não Configured → recusa via refuseOAuthProvider (503 sem credencial / 501 provider desconhecido — O-034); valida next via IsTrustedRedirect (descarta se malicioso); State.Issue(next) para embutir/assinar; wave 9: grava o cookie tx (axuz_oauth_tx: verifier PKCE + nonce + hash do state, assinado) e, se o provider fala PKCE (Google), redireciona com code_challenge S256 + nonce; senão http.Redirect(302) pra AuthURL(state).
Entradas: chi URL param "provider"; query next (opcional).
Retorno: 302 pro provider; 503 quando o provider existe mas não tem credencial; 501 quando o nome do provider é desconhecido; 500 se State.Issue falha. Efeito: emite Location header + Set-Cookie axuz_oauth_tx; nenhum DB.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
provider | path | string | yes |
Responses
200
Sucesso.
302
Pro provider
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
429
Limite de requisições excedido.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
500
Se State.Issue falha. Efeito: emite Location header + Set-Cookie axuz_oauth_tx
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
501
Quando o nome do provider é desconhecido
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
503
Quando o provider existe mas não tem credencial
| 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 GET 'https://auth-api.axuz.net/auth/oauth/PROVIDER/start'Node.js
const res = await fetch("https://auth-api.axuz.net/auth/oauth/PROVIDER/start", {
method: 'GET',
});
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(
"GET",
"https://auth-api.axuz.net/auth/oauth/PROVIDER/start",
timeout=30,
)
res.raise_for_status()
print(res.json())