Overview
The API supports multiple authentication methods to provide secure access:- Local Authentication - Email and password-based authentication
- OAuth 2.0 - GitHub, Google, and Microsoft OAuth providers
- JWT Tokens - JSON Web Tokens for stateless authentication
Authentication Flow
Local Authentication
- User signs up with email and password via
/auth/signup - User logs in with credentials via
/auth/login - Server returns a JWT access token
- Client includes token in
Authorizationheader for subsequent requests
OAuth Authentication
- Client initiates OAuth flow via
/auth/oauth/{provider} - Server returns authorization URL and state token
- User completes OAuth flow with provider
- Provider redirects to
/auth/oauth/{provider}/callbackwith authorization code - Server exchanges code for access token and returns JWT
Token Management
Token Structure
JWT tokens include the following claims:jti- Unique token identifieruser_id- User UUIDrole- User role nameauth_provider- Authentication provider (local, github, google, microsoft)token_version- Token version for revocationexp- Expiration timestampiat- Issued at timestamp
Token Revocation
Tokens can be revoked in two ways:- Individual revocation - Logout endpoint revokes specific token by JTI
- Bulk revocation - Password updates increment token_version, invalidating all previous tokens
Authentication Providers
Available Providers
List of enabled authentication providers
Provider name:
local, github, google, or microsoftProvider Configuration
Each OAuth provider requires configuration:- Client ID - OAuth application identifier
- Client Secret - OAuth application secret
- Redirect URI - Callback URL for OAuth flow
- Tenant ID - (Microsoft only) Azure AD tenant identifier
Security Features
Password Requirements
When password validation is enabled, passwords must contain:- Minimum 12 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one digit
- At least one special character:
!@#$%^&*(),.?":{}|<>
Password Hashing
Passwords are hashed using bcrypt with automatic salt generation.Token Expiration
Access tokens expire after a configurable number of days (default: varies by configuration).Common Endpoints
List Providers
Get Current User
Logout
Error Handling
Common Error Responses
Error message describing what went wrong
Next Steps
OAuth Authentication
Learn about OAuth flows for GitHub, Google, and Microsoft
JWT Tokens
Understand JWT structure and validation