Overview
TheAuth0ClientOptions interface defines all configuration options available when creating an Auth0Client instance. These options control authentication behavior, session management, token handling, and security features.
Type Definition
Required Configuration
These options must be provided either through the constructor or environment variables:The Auth0 domain for your tenant (e.g.,
example.us.auth0.com).Environment variable: AUTH0_DOMAINThe Auth0 application client ID.Environment variable:
AUTH0_CLIENT_IDThe Auth0 application client secret. Either this or
clientAssertionSigningKey must be provided.Environment variable: AUTH0_CLIENT_SECRETA 32-byte, hex-encoded secret used for encrypting session cookies.Environment variable:
AUTH0_SECRETGenerate with: openssl rand -hex 32Authorization Server Options
Additional parameters to send to the
/authorize endpoint. See AuthorizationParameters below.Enable Pushed Authorization Requests (PAR) for enhanced security.
Private key for use with
private_key_jwt client authentication. Can be a PEM string or CryptoKey.Environment variable: AUTH0_CLIENT_ASSERTION_SIGNING_KEYAlgorithm used to sign client assertion JWT (e.g., “RS256”, “ES256”).Environment variable:
AUTH0_CLIENT_ASSERTION_SIGNING_ALGApplication Options
The base URL(s) of your application (e.g.,
http://localhost:3000).- Single URL:
"https://app.example.com" - Multiple URLs:
["https://app.example.com", "https://myapp.vercel.app"] - Environment variable:
APP_BASE_URL(comma-separated for multiple)
Path to redirect users to after successful authentication.
Session Options
Configure session timeouts and behavior.
Custom session store implementation for database-backed sessions.
Logout Options
Logout endpoint selection strategy:
auto- Try OIDC RP-Initiated Logout, fallback to/v2/logoutoidc- Always use OIDC RP-Initiated Logoutv2- Always use Auth0/v2/logoutendpoint
Include
id_token_hint parameter in OIDC logout URLs. Recommended for security.Hooks
Callback to modify the session before it’s persisted.Example:
Callback to handle post-authentication logic or customize redirects.Example:
Token Options
Number of seconds before token expiration to trigger automatic refresh.Example: With
tokenRefreshBuffer: 60, tokens expiring within 60 seconds will be proactively refreshed.Enable the
/auth/access-token endpoint for client-side token access.DPoP Configuration
Enable DPoP (Demonstrating Proof-of-Possession) for cryptographically bound tokens.Example:
ES256 key pair for DPoP proof generation.Can be loaded from environment variables:
AUTH0_DPOP_PUBLIC_KEYAUTH0_DPOP_PRIVATE_KEY
DPoP timing and retry configuration.
MFA Configuration
MFA context TTL in seconds. Controls how long encrypted
mfa_token remains valid.Environment variable: AUTH0_MFA_TOKEN_TTLRoute Configuration
Customize authentication route paths.Environment variables:
NEXT_PUBLIC_LOGIN_ROUTENEXT_PUBLIC_PROFILE_ROUTENEXT_PUBLIC_ACCESS_TOKEN_ROUTE
Enable the
/auth/connect endpoint for connecting additional accounts.Network and Security
Allow HTTP requests to authorization server. Only for testing with mock OIDC providers. Cannot be used in production.
HTTP timeout in milliseconds for authentication requests.
Send library name and version to Auth0 via
Auth0-Client header.Allow multiple concurrent authentication transactions.
Return 204 No Content instead of 401 Unauthorized for unauthenticated profile endpoint requests.
AuthorizationParameters
OAuth scopes to request. Space-delimited string.
API identifier for the target resource server.
Override the redirect URI for the callback.
Maximum authentication age in seconds. Forces re-authentication if exceeded.
Organization ID for organization-specific login.
Usage Example
See Also
- SessionData - Session data structure
- User - User profile interface
- TokenSet - Token structure