OAuth
AIUS provides a full OAuth 2.0 and OpenID Connect (OIDC) provider that allows third-party applications to authenticate users using AIUS accounts.Overview
OAuth 2.0 is an authorization framework that enables applications to obtain limited access to user accounts on an HTTP service. OpenID Connect (OIDC) is an authentication layer built on top of OAuth 2.0 that allows clients to verify the identity of the user and obtain basic profile information.Features
- OAuth 2.0 Authorization Code Flow with PKCE (S256) for public clients
- OAuth 2.0 Authorization Code Flow for confidential clients
- OpenID Connect (OIDC) with ID tokens
- JWT Access Tokens signed with RS256
- Token Introspection and Revocation endpoints
- Refresh Token Rotation for enhanced security
- Scope-based Authorization
How It Works
- Redirect users to AIUS for authentication
- Receive an authorization code after user consent
- Exchange the code for access tokens
- Use tokens to access AIUS APIs on behalf of the user
Authorization Flow
The OAuth 2.0 authorization code flow is the most secure OAuth flow, suitable for both public and confidential clients.Step 1: Redirect to Authorization Endpoint
| Parameter | Required | Description |
|---|---|---|
response_type | Yes | Must be code |
client_id | Yes | Your OAuth client ID |
redirect_uri | Yes | Must match registered URI (HTTPS, except localhost) |
scope | Yes | Requested scopes (space-separated) |
state | Yes | Random string for CSRF protection |
code_challenge | Yes* | PKCE challenge (required for public clients) |
code_challenge_method | Yes* | Must be S256 (required for public clients) |
nonce | Yes* | Random string for replay protection (required for OIDC) |
Step 2: User Authentication and Consent
The user signs in to their AIUS account and reviews the permissions your application is requesting. If they grant consent, AIUS redirects back to your app with an authorization code.Step 3: Receive Authorization Code
state parameter matches the one you sent to prevent CSRF attacks.
PKCE Implementation (Public Clients)
For public clients (mobile apps, SPAs), you must implement PKCE:Token Exchange
After receiving an authorization code, exchange it for access and refresh tokens.Token Endpoint
Authorization Code Grant
Refresh Token Grant
Using Access Tokens
Include the access token in theAuthorization header:
Scopes
Scopes define the permissions your application can request.Available Scopes
Identity Scopes:openid- Required for OpenID Connectprofile- Basic user profile information (name, picture)email- User email and verification status
orgs:read- Read access to organizationsorgs:write- Write access to organizationsapi:read- Read access to AIUS APIapi:write- Write access to AIUS API
Requesting Scopes
Include scopes as a space-separated list:Client Management
Client Types
Public Clients (cannot securely store secrets):- Mobile apps
- Single-page applications (SPAs)
- Native desktop applications
- Web servers
- Backend services
Registering a Client
Contact AIUS support to register your OAuth client. You’ll need to provide:- Application name and description
- Redirect URIs (must be HTTPS, except localhost)
- Required scopes
- Client type (public or confidential)
Redirect URI Requirements
- Must use HTTPS in production (localhost is exception)
- Must match exactly (including path and query parameters)
- No wildcard support - register each exact URI
Security Best Practices
- Store secrets in environment variables or secure secret management systems
- Never hardcode secrets in source code
- Always use HTTPS for redirect URIs in production
- Request only the scopes your application needs
- Rotate client secrets regularly
Security Features
- PKCE mandatory for public clients (S256)
- State parameter mandatory for all flows (CSRF protection)
- Redirect URI validation with exact match allow-list
- Client authentication for confidential clients
- Short-lived access tokens (1 hour)
- Refresh token rotation on every use
- Token revocation support
Getting Started
- Register an OAuth Client - Contact AIUS support
- Implement Authorization Flow - Redirect users to AIUS authorization endpoint
- Exchange Tokens - Use the token exchange endpoint
- Access Protected Resources - Use access tokens to access AIUS APIs
Support
For OAuth client registration, configuration, or management issues:- Email: support@aius.co
- Include your client_id in all communications