Skip to content

Auth

Registration, login, SSO, password management, and account deletion.

Supported values

Use these exact conventions when calling auth endpoints.

Field / conceptAccepted valuesNotes
provider (SSO)"google", "googleoauth"Case-insensitive. Only Google sign-in is supported today. Any other value returns 400 with "Only Google SSO is supported".
username / email (login)Valid email addressThe server field is email; username is accepted as an alias. Trimmed and lowercased server-side.
email (register)Valid email addressTrimmed and lowercased server-side. Must be unique.
password (register, change, set, reset)10–128 charactersMust include at least one uppercase letter, one lowercase letter, one digit, and one special character.
token_type (response)"bearer"Always bearer on successful token responses.
organization.tier (response)"free", "pro", "max"Assigned by EchoMode; new self-serve orgs start on "free".
redirect_uri (SSO)Absolute HTTPS/HTTP URLOptional on POST /auth/sso/authorize. When omitted, the deployment default callback URL is used. Must match an allowlisted origin for your environment or the request returns 400.

SSO sign-in flow

  1. POST /auth/sso/authorize with provider: "google" (or "googleoauth") and an optional redirect_uri.
  2. Redirect the user's browser to the returned authorization_url.
  3. After Google sign-in, the browser lands on your callback URL with code and state query parameters.
  4. Exchange them via GET /auth/sso/callback?code=...&state=... to receive the same token payload as password login.

If Google SSO is not enabled on the deployment, POST /auth/sso/authorize returns 501.


POST /auth/register

Create a new account and organization.

Request body

FieldTypeRequiredDescription
emailstringyesAccount email (normalized to lowercase)
passwordstringyes10–128 chars; uppercase, lowercase, digit, and special character required
first_namestringno
last_namestringno
display_namestringno
org_namestringnoOrganization name

Response 201

json
{
  "access_token": "eyJ...",
  "token_type": "bearer",
  "expires_in": 3600,
  "refresh_token": "eyJ...",
  "organization": {
    "org_id": "uuid",
    "name": "Example Org",
    "tier": "free",
    "is_org_admin": true
  },
  "is_new_user": true,
  "needs_profile_completion": false
}

POST /auth/login

Authenticate with email and password.

Request body

FieldTypeRequiredDescription
usernamestringyesAccount email (same value used at registration). The server field is email; username is accepted as an alias for backwards compatibility. Must be a valid email address.
passwordstringyesAccount password

Response 200 — same shape as register.

POST /auth/refresh_tokens

Exchange a refresh token for a new token pair.

Request body

FieldTypeRequired
refresh_tokenstringyes

Response 200 — same shape as register.

POST /auth/logout

Revoke the current refresh token.

Request body

FieldTypeRequired
refresh_tokenstringyes

Response 204 No content.

POST /auth/sso/authorize

Start Google sign-in and receive an authorization URL.

Request body

FieldTypeRequiredDescription
providerstringyes"google" or "googleoauth" (case-insensitive)
redirect_uristringnoOAuth callback URL where Google returns code and state. Uses the deployment default when omitted.

Example request

json
{
  "provider": "google",
  "redirect_uri": "https://app.example.com/auth/sso/callback"
}

Response 200

json
{
  "authorization_url": "https://accounts.google.com/o/oauth2/..."
}

GET /auth/sso/callback

Complete Google sign-in after the browser redirect.

Query parameters

ParamTypeRequiredDescription
codestringyesAuthorization code from Google
statestringyesCSRF state issued during POST /auth/sso/authorize

Response 200 — same token shape as login, including:

FieldDescription
is_new_usertrue on first Google sign-in (account and org auto-created)
needs_profile_completiontrue when the user should finish profile details in your UI

POST /auth/change-password

Change the current user's password.

Request body

FieldTypeRequiredDescription
current_passwordstringyesExisting account password
new_passwordstringyes10–128 chars; uppercase, lowercase, digit, and special character required

Response 204 No content.

POST /auth/set-password

Set an initial password on an SSO-only account.

Request body

FieldTypeRequiredDescription
passwordstringyes10–128 chars; uppercase, lowercase, digit, and special character required

Response 204 No content.

DELETE /auth/account

Soft-delete the current account and invalidate all sessions.

Request body

FieldTypeRequiredDescription
passwordstringnoCurrent account password for verification. Required for password-based accounts; omit for SSO-only accounts.

Response 204 No content.


Auth implementation notes

EchoMode uses RS256-signed JWTs (asymmetric key pair) with refresh-token rotation. Access tokens include org_id, team_ids, and admin flags as custom claims. Refresh tokens are tracked server-side and revoked on password change or account deletion.

Current auth methods:

MethodStatusFlow
Email + passwordSupportedPOST /auth/register or POST /auth/login
Google OAuth (SSO)SupportedPOST /auth/sso/authorize → redirect → GET /auth/sso/callback
Refresh token rotationSupportedPOST /auth/refresh_tokens

Rate limiting: Auth endpoints are rate-limited per IP (refresh, SSO callback) or per IP+email (login, register) to prevent credential-stuffing and brute-force attacks.