Authentication Overview
Authentication is the process of verifying the identity of a user or service. Frontier provides a comprehensive authentication system that supports multiple strategies for both human users and machine service users.A user is always authenticated to prove its identity before it can be authorized to access a resource. Authentication is always the first step in accessing resources.
Authentication Types
Frontier supports two primary types of authentication:- User Authentication - For human users accessing your application through a web browser
- Service User Authentication - For machine-to-machine communication and API access
User Authentication Strategies
For human users, Frontier provides the following authentication strategies:1. Social Login (OIDC)
Authenticate users via third-party identity providers like Google, GitHub, and Facebook using OpenID Connect (OIDC) protocol. Supported Providers:- GitHub
- Any OIDC-compliant provider
- Secure OAuth 2.0 / OIDC flow
- Automatic user registration on first login
- Profile information sync
- Session-based authentication with cookies
2. Email One-Time Password (OTP)
Send a one-time password to the user’s email address for passwordless authentication. Key Features:- Passwordless authentication
- Time-limited OTP codes (default: 10 minutes)
- Rate limiting to prevent brute force attacks
- Configurable email templates
3. Email Magic Links
Send a unique authentication link to the user’s email that logs them in when clicked. Key Features:- One-click authentication
- Time-limited links
- No password required
- Secure token-based flow
4. Passkey Authentication
Modern biometric and device-based authentication using WebAuthn standard. Key Features:- Biometric authentication (fingerprint, face recognition)
- Hardware security key support
- Phishing-resistant
- No passwords to remember
Service User Authentication Strategies
For machine service users, Frontier provides:1. Client ID/Secret (Client Credentials Grant)
Traditional OAuth 2.0 client credentials flow using client ID and secret. Use Cases:- Backend services
- Scheduled jobs
- Server-to-server communication
2. Private/Public Key JWT (JWT Bearer Grant)
Asymmetric key-based authentication using RSA key pairs. Use Cases:- High-security environments
- Distributed systems
- Microservices architecture
- No secret storage required (only private key)
Authentication Flow
Application queries Frontier for available authentication strategies and presents options to the user.
curl --location 'http://localhost:7400/v1beta1/auth/register/google' \
--header 'Accept: application/json'
Identity provider redirects back to Frontier with authorization code. Frontier verifies the code and creates or retrieves the user.
Session-Based vs Token-Based Authentication
Session-Based (Recommended for Web Apps)
- Session stored as encrypted cookie
- Automatic session management
- CSRF protection built-in
- Best for browser-based applications
Token-Based (Recommended for APIs)
- JWT access tokens
- Stateless authentication
- Can be verified without database calls
- Best for microservices and mobile apps
x-user-token header.
Access Tokens
Frontier can generate JWT access tokens that can be verified by any service using Frontier’s public keys. Token Features:- RS256 signing algorithm
- Configurable validity period (default: 1 hour)
- Custom claims for context (org_id, project_id)
- Public key verification via JWKS endpoint
Security Features
For User Authentication
- Encrypted sessions - AES encryption for session cookies
- HTTPS enforcement - Secure cookie transmission
- CSRF protection - Built-in token validation
- Redirect URL whitelisting - Prevent open redirect vulnerabilities
- Callback URL validation - Only allowed URLs accepted
For Service User Authentication
- Secret hashing - Client secrets stored with bcrypt
- Rate limiting - Protection against brute force
- Token expiration - Short-lived access tokens
- Key rotation - Support for multiple active keys
Configuration Example
Here’s a complete authentication configuration:Generating RSA Keys
To enable JWT access tokens, generate RSA key pairs:rsa- Private key (keep secure)rsa.pub- Public key (can be shared)
rsa_path in your configuration to the directory containing these files.
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1beta1/auth | GET | List available authentication strategies |
/v1beta1/auth/register/{strategy} | GET | Start authentication flow |
/v1beta1/auth/callback | GET | Handle OAuth callback |
/v1beta1/auth/token | POST | Exchange credentials for access token |
/v1beta1/auth/logout | POST | End user session |
/.well-known/jwks.json | GET | Public keys for token verification |
Next Steps
User Authentication
Learn about user registration, login flows, and session management
Service Users
Authenticate services and machines with API keys and JWT
Sessions
Understand session lifecycle, tracking, and management
Organization Domains
Configure domain verification for auto-joining organizations
Related Resources
- Authorization Overview - Learn about permissions and policies
- API Reference - Complete API documentation
- Configuration Reference - All configuration options