Skip to Content
API ReferenceAuthEndpoints

Auth

Everything under /api/auth is served by src/routes/auth.ts. No route on this router has role middleware; only refresh and logout require a token (strict). The flows, the token claims, role resolution, revocation and the access rules of every other endpoint are on Architecture → Authentication; this page is the operation index. The full parameter contract is in Swagger (/swagger), which does not document POST /embed.

Authentication · Endpoint access · W9 OTP login, refresh and logout

Operations

No auth route writes Cache-Control. “Relayed upstream status” means a failed Repliers call answered with Repliers’ own status (error variants).

Method & pathAuthCached / headerSide effectsErrorsDeep dive
GET /api/auth/{provider}/urlnone; provider must be google or facebooknonenone400 (unknown provider, invalid redirect_uri, no redirect_uri sent or configured); 500 for facebook (no OIDC configuration)OAuth
POST /api/auth/{provider}/cbnonenoneFirst sign-in of an unknown email: Repliers client created and a registration event sent, not awaited. Agent sign-in: FUB user lookup400 (provider, body or query validation, no id_token, no email in it); the provider’s status for a rejected code; relayed upstream status; 500 otherwiseOAuth
POST /api/auth/loginnoneRetry-After on the cooldown 403Code and cooldown marker in Keyv otp; Repliers message; the client’s email preferences re-enabled when off400 (neither email nor phone, bad format); 404 User not found; 403 + Retry-After inside AUTH_OTP_RESEND_TTL_MS; 500 when the preferences update fails; relayed upstream statusOTP login
POST /api/auth/otpnonenoneThe code is deleted400 (code not 6 characters); 403 unknown or used code; 500 when the ACL query fails; relayed upstream statusOTP login
POST /api/auth/refreshstrictnoneOld jti blocklisted until its exp401 (no, invalid, expired or revoked token); 500 for a token without iat/exp or a failed ACL queryRefresh and logout
POST /api/auth/logoutstrictnonejti blocklisted until its exp401 (no, invalid, expired or revoked token)Refresh and logout
POST /api/auth/signupnoneRetry-After on the cooldown 403Repliers client created; registration event sent, not awaited; then the code, the cooldown marker and the message as for login400 (validation); 409 relayed when the client exists; 403 + Retry-After inside the cooldown; 500 when the preferences update fails; relayed upstream status. No 404: signup passes the new client to login, which skips the lookupSignup
POST /api/auth/repliers-tokennoneRetry-After when auto_otp hits the cooldownWith AUTH_EMAILTOKEN_AUTO_OTP=true and an expired message token: a new code and message400 (not a UUID; AUTH_EMAILTOKEN_ENABLED off); 403 unknown or expired token; 412 expired with auto_otp; 403 + Retry-After when that re-send is inside the cooldown; relayed upstream statusEmail token
POST /api/auth/embednone; FUB context signature checked in the servicenonenone400 (validation); 401 Invalid signature; 500 for a context that is not base64 JSON or a failed ACL queryFUB embed login

Response bodies

EndpointBody
login, signup{ "result": true }, plus "code" with DEBUG_AUTH_OTP_EXPOSE_CODE=true
otp, {provider}/cb{ "token": "<jwt>", "profile": { … } }: the client’s fname, lname, phone, email, status, preferences, tags, or for an agent fname, lname, phone, email, status
{provider}/url{ "url": "<authorization URL>" }
refresh{ "token": "<jwt>" }
logout{ "result": true }
repliers-token{ "result": { "token": "<jwt>", "profile": { … } } }
embed{ "result": { "jwt": "<jwt>", "clientSignature": "<hex>" } }

Notes

The notes that used to be listed here now live with their mechanism:

Verified against portal-backend 997ae3e, 2026-10-20.

Last updated on