OAuth Flow
Initiate OAuth Login
Relative URL to redirect to after successful login (e.g.,
/invite?token=abc). Must start with / and not //.OAuth Callback
- Validates the state token
- Exchanges the authorization code for an access token
- Fetches user profile from Google
- Creates or updates user account
- Creates a session
- Handles tier selection (if billing is enabled)
- Handles invite flow (if redirect cookie present)
Authorization code from Google OAuth
State token for CSRF protection
/tier/select- If billing enabled and user hasn’t selected a tier- Invite page - If user was invited to a team
/- Dashboard for existing users
Session Management
Logout
Relative URL to redirect to after logout (default:
/)/) and clears the session cookie.
Example:
Session Details
Sessions are created after successful OAuth authentication and stored in the database with the following properties:- ID: Unique session identifier stored in HTTP-only cookie
- UserID: Associated user ID
- Email: User’s email address
- Tier: User’s subscription tier (free, business, enterprise)
- CurrentTeamID: Active team context for RBAC operations
- IPAddress: Client IP address at session creation
- UserAgent: Client user agent string
- ExpiresAt: Session expiration timestamp
Session Cookie Configuration
- Name:
session(configurable) - HttpOnly:
true(prevents JavaScript access) - Secure:
truein production - SameSite:
Lax - Path:
/ - Domain: Configurable (supports subdomains)
- MaxAge: Configurable (default varies by deployment)
Dev Mode Authentication
Dev Login (Development Only)
devMode: true in configuration.
Query Parameters:
Email address for dev user (default:
[email protected])Registration Policies
The API supports three registration policies:- Open - Anyone can register
- Allowed Domains - Only users with email addresses from configured domains can register
- Invite Only - Users can only register via team invitations
403 Forbidden response.
First User Special Handling
The first user to authenticate receives special privileges:- Automatically assigned
platform_adminrole - Receives enterprise tier (when billing is disabled)
- Creates the initial organization and team
Error Responses
All authentication endpoints may return the following errors:Human-readable error message
Common Error Codes
- 400 Bad Request - Invalid state token or missing authorization code
- 403 Forbidden - Registration policy violation or email not verified
- 500 Internal Server Error - Token exchange failed or database error