Skip to main content

By default Phoenix deploys with authentication disabled as you may be just trying Phoenix for the very first time or have Phoenix deployed in a VPC. However you might want to further protect access to your data via authentication. Below are the steps.

Info

Authentication will stop collecting traces and block all API access until API keys are created. For that reason we recommend scheduling some downtime if you have already deployed phoenix.

Setup#

To enable authentication on your Phoenix, you will have to set two environment variables:

VariableDescriptionExample Value
PHOENIX_ENABLE_AUTHSet to True to enable authentication on your platformTrue or False
PHOENIX_SECRETA long string value that is used to sign JWTs for your deployment. It should be a good mix of characters and numbers and should be kept in a secret store of some kind.3413f9a7735bb780c6b8e4db7d946a492b64d26112a955cdea6a797f4c833593

The following environment variables are optional but recommended:

VariableDescription
PHOENIX_USE_SECURE_COOKIESIf set to True, access and refresh tokens will be stored in secure cookies. Defaults to False.
PHOENIX_CSRF_TRUSTED_ORIGINSA comma-separated list of origins allowed to bypass Cross-Site Request Forgery (CSRF) protection. This setting is recommended when configuring OAuth2 clients or sending password reset emails. If this variable is left unspecified or contains no origins, CSRF protection will not be enabled. In such cases, when a request includes origin or referer headers, those values will not be validated.

Deploy Phoenix with the above environment variables set. You will know that you have setup authentication correctly if the UI navigates to to a login screen.

By default Phoenix will create an admin user account. To get started:

  1. Log in as the admin user. The email should be admin@localhost and the password will be admin
  2. Set a new password for admin. You will be prompted to set a new password. Use a sufficiently complex password and save it in a safe place.
  3. Go to the settings page on the left nav and create your first system API key. This API key can be used to log traces, use the Phoenix client, and programmatically hit Phoenix’s APIs. Store the system API key in a safe place.
  4. In your application code, make sure to set the proper authentication headers with the system API key. Phoenix respects headers in the form of bearer auth, meaning that you should set the header in the form Authorization: Bearer <token>. Note that if you are using the Phoenix Client or Phoenix Otel, you simply need to set the PHOENIX_API_KEY environment variable.

Re-deploy your application with the API key created above and you will see traces stream in as before.

Warning

Initial admin password: You can set the initial password via the PHOENIX_DEFAULT_ADMIN_INITIAL_PASSWORD environment variable. It is only read on first startup when the default admin account is created; subsequent changes have no effect if the account already exists. If you need to change the admin password later, do so from the UI or via an admin password reset.

Docker example:

Helm users can set auth.defaultAdminPassword or provide the secret key PHOENIX_DEFAULT_ADMIN_INITIAL_PASSWORD in the chart’s Secret.

Password Policy#

By default, Phoenix requires passwords to be a minimum of 4 characters long. For deployments that need stricter security, you can enable a strong password policy by setting the PHOENIX_ENABLE_STRONG_PASSWORD_POLICY environment variable to True.

When the strong password policy is enabled, passwords must meet all of the following requirements:

  • At least 12 characters long
  • At least one uppercase letter
  • At least one lowercase letter
  • At least one number
  • At least one special character (!@#$%^&*()_+)

Brute Force Login Protection#

Phoenix includes built-in brute force login protection that temporarily locks accounts after repeated failed login attempts. By default, after 5 failed attempts, the account is locked out for 5 minutes.

  • PHOENIX_BRUTE_FORCE_LOGIN_PROTECTION_MAX_ATTEMPTS: Maximum number of failed login attempts before temporary lockout. Defaults to 5.
  • PHOENIX_DISABLE_BRUTE_FORCE_LOGIN_PROTECTION: Set to true to disable brute force login protection entirely. Defaults to false.

User Management#

Users can be added and removed from a Phoenix instance with authentication enabled. Users have one of three roles: admin, member, or viewer. See permissions below to learn more about the permissions for each role.

Only admins can manage phoenix users. They can add, delete, and reset the passwords of other users. To manage users go to the /settings page.

Permissions#

This section outlines the specific actions that users can perform based on their assigned roles within the system: Admin, Member, and Viewer. The permission matrix is divided into two main categories:

  • Mutations: Operations that allow users to create, update, or delete data within the system.
  • Queries: Operations that enable users to retrieve or view data from the system.

Mutations#

Mutations are operations that enable users to create, update, or delete data within the system. This permission matrix ensures that only authorized roles can execute sensitive actions, such as managing users and API keys, while allowing members to perform essential account-related updates like changing their own passwords and usernames. Viewers have read-only access and cannot perform mutations.

Info

Neither an Admin, Member, nor Viewer is permitted to change email addresses.

ActionAdminMemberViewer
Create User✅ YesNoNo
Delete User✅ YesNoNo
Change Own Password✅ Yes✅ Yes✅ Yes
Change Other’s Password✅ YesNoNo
Change Own Username✅ Yes✅ Yes✅ Yes
Change Other’s Username✅ YesNoNo
Create System API Keys✅ YesNoNo
Delete System API Keys✅ YesNoNo
Create Own User API Keys✅ Yes✅ Yes✅ Yes
Delete Own User API Keys✅ Yes✅ Yes✅ Yes
Delete Other’s User API Keys✅ YesNoNo
Create/Update Secrets✅ YesNoNo
Delete Secrets✅ YesNoNo

Queries#

Queries are operations that allow users to retrieve and view data from the system.

Info

This table only shows actions that a Member or Viewer is not permitted to do. Actions without restrictions (such as viewing traces, projects, datasets, etc.) are omitted.

ActionAdminMemberViewer
List All System API Keys✅ YesNoNo
List All User API Keys✅ YesNoNo
List All Users✅ YesNoNo
Fetch Other User’s Info, e.g. emails✅ YesNoNo
View Secret Values✅ YesNoNo

REST API Permissions (v1/ endpoints)#

For programmatic access via REST API endpoints (paths beginning with /v1/), permissions are determined by both the user’s role and the HTTP method used:

Endpoint CategoryAdminMemberViewer
GET requests (read operations)
Projects, datasets, experiments, prompts, spans, traces, annotations, annotation configs
✅ Yes✅ Yes✅ Yes
POST/PUT/DELETE requests (write operations)
Creating, updating, or deleting resources
✅ Yes✅ Yes❌ No
(403 Forbidden)
Personal API-key self-service
GET /v1/user/api_keys
POST /v1/user/api_keys
DELETE /v1/user/api_keys/
✅ Yes✅ Yes✅ Yes
API-key administration
GET /v1/users/api_keys
GET/POST/DELETE /v1/system/api_keys
✅ Yes❌ No
(403 Forbidden)
❌ No
(403 Forbidden)
User management endpoints
GET /v1/users
POST /v1/users
DELETE /v1/users/
✅ Yes❌ No
(403 Forbidden)
❌ No
(403 Forbidden)
Project management endpoints
PUT /v1/projects/
DELETE /v1/projects/
✅ Yes❌ No
(403 Forbidden)
❌ No
(403 Forbidden)
Secrets management endpoints
PUT /v1/secrets
✅ Yes❌ No
(403 Forbidden)
❌ No
(403 Forbidden)
Warning

Viewer role restrictions for REST API:

  • Viewers have read-only access to v1/ endpoints
  • All GET requests are allowed (viewing projects, datasets, experiments, traces, spans, etc.)
  • Write operations (POST, PUT, DELETE) return 403 Forbidden, except that viewers may create and revoke their own user API keys
  • User management and project CRUD operations are also blocked

Examples of blocked operations for Viewers:

  • Creating datasets: POST /v1/datasets/upload
  • Creating experiments: POST /v1/datasets/{id}/experiments
  • Creating annotations: POST /v1/span_annotations
  • Uploading traces: POST /v1/traces
  • Deleting resources: DELETE /v1/datasets/{id}, DELETE /v1/experiments/{id}

API Keys#

There are two kinds of API keys in Phoenix: system and user.

System Keys#

System keys act on behalf of the system as a whole rather than any particular user. They can only be created by admins, are not meaningfully associated with the admin who creates them except for auditing purposes, and do not disappear if that admin is deleted. A system key would be the recommended kind of key to use in programmatic interactions with Phoenix that do not involve a user (e.g., automated flows querying our REST APIs).

Creating a system key requires an admin access-token session or PHOENIX_ADMIN_SECRET, on both REST and GraphQL. API keys cannot mint additional keys.

User Keys#

User API keys are associated with and act on behalf of the user to which they are issued. That user has the ability to view and delete their own user keys, and if the user is deleted, so are all of their associated user keys. A user might create their own user key into order to run an experiment in a notebook, for example.

Creating a user key requires an access-token session, on both REST and GraphQL; an existing API key cannot mint a replacement. Through Phoenix 18, GraphQL allowed API-key-authenticated issuance for backward compatibility; as of Phoenix 19 both surfaces enforce the same non-transitive policy. Workflows that used an API key for unattended key creation must instead provision keys from a logged-in session (for example, the Settings page or a script that authenticates with user credentials).

Setting and Using API Keys with Environment Variables#

Phoenix API keys can be set with the PHOENIX_API_KEY environment variable:

If authentication is enabled on Phoenix, all interactions with the server need to include an authorization header. Phoenix will read the PHOENIX_API_KEY environment variable, and automatically include it as an authorization header. Interactions with Phoenix include:

  • Using phoenix.Client
  • Running experiments
  • Sending OpenInference traces (more details below)

Sending OpenInference traces#

API Keys also need to be included on OpenInference traces sent to the Phoenix server. If you’ve set the PHOENIX_API_KEY environment variable, the phoenix.otel module will automatically include an authorization header with the API key:

Alternatively, you can explicitly set the authorization header on the exporter if using OpenTelemetry primitives directly.

Info

If setting authorization headers explicitly, ensure that the header field is lowercased to ensure compatibility with sending traces via gRPC

Agent Authentication Discovery#

Phoenix serves three discovery endpoints so AI agents can learn how to authenticate against a deployed instance. All are always available and require no configuration:

  • GET /auth.md — a human- and agent-readable Markdown guide describing this deployment’s auth model. When authentication is disabled it states that all endpoints are public; when enabled it directs the caller to create an API key under Settings → API Keys and send an Authorization: Bearer <token> header. It follows the auth.md convention.
  • GET /.well-known/oauth-protected-resource — RFC 9728 Protected Resource Metadata (JSON), advertising the resource, that bearer tokens are sent in the header, and a link to /auth.md.
  • GET /.well-known/oauth-protected-resource/mcp — the same RFC 9728 metadata scoped to the built-in MCP server, advertising /mcp as the protected resource so MCP clients can discover how to authenticate against it. It is served only when the MCP server is mounted at /mcp (the default) and otherwise responds 404.

When authentication is enabled, 401 Unauthorized responses include a WWW-Authenticate header pointing at the Protected Resource Metadata endpoint, giving agents a stable entry point for discovering how to authenticate. When the OAuth2 authorization server is enabled, the metadata also advertises it, so OAuth-capable clients (such as MCP clients) can log in interactively; other clients are provisioned out of band with API keys, and access is always governed by the role of the user the credential belongs to.

OAuth2 Authorization Server#

When authentication is enabled, Phoenix also acts as its own OAuth2 authorization server so that interactive clients — MCP clients like Claude Code and Cursor connecting to the Remote MCP Server, and the Phoenix CLI — can log in through the browser instead of handling long-lived API keys. The flow is standard authorization code with PKCE: clients register via RFC 7591 dynamic client registration, discover endpoints via RFC 8414 server metadata, and a token is minted only after a logged-in user approves the consent page. Tokens are audience-bound to the resource they were minted for and carry the permissions of the approving user.

Note

Don’t confuse this with Configuring OAuth2 Identity Providers below, where Phoenix is the client logging your users in against Google, Okta, etc. (PHOENIX_OAUTH2_<IDP>_* variables). Here Phoenix is the server, issuing its own tokens to MCP and CLI clients.

Registration alone grants no authority: an authorization code is delivered only to the exact registered redirect URI, PKCE binds the exchange to the flow’s initiator, and nothing is issued without a logged-in user’s consent. The defaults are designed to work out of the box with MCP clients in the wild; the variables below let you tighten or disable the surface.

VariableDescription
PHOENIX_ENABLE_OAUTH2_AUTHORIZATION_SERVERWhether Phoenix serves the built-in authorization server. Defaults to true. When false, the /oauth2/* endpoints and the RFC 8414 discovery document respond 404, and the protected-resource metadata stops advertising an authorization server. Previously minted access tokens remain valid until they expire, but grants can no longer be refreshed. API keys and browser login are unaffected. Has no effect unless authentication is enabled.
PHOENIX_OAUTH2_GRANT_EXPIRY_DAYSHow long, in days, an OAuth2 grant lives. Refresh-token rotation never extends a token’s life past its grant’s expiry, so this is the hard ceiling on how long a consent lasts before the user must log in again. Defaults to 90.
PHOENIX_OAUTH2_DYNAMIC_CLIENT_REGISTRATIONWhich redirect URI mechanisms public clients may register. One of enabled, local_only, disabled. Defaults to enabled — MCP clients in the wild (e.g., Cursor) register HTTPS redirect URIs alongside loopback and private-use-scheme ones, and rejecting HTTPS breaks those clients out of the box. Set to local_only to accept only loopback and private-use-scheme redirects, or disabled to turn off dynamic registration entirely.
PHOENIX_OAUTH2_ALLOWED_REDIRECT_HOSTSA comma-separated list of hosts allowed as HTTPS redirect targets for dynamic client registration, e.g. PHOENIX_OAUTH2_ALLOWED_REDIRECT_HOSTS=cursor.com,example.com. When unset, all HTTPS redirect hosts are accepted while dynamic client registration is enabled. Use this to keep browser-based clients working while pinning exactly which services may receive authorization codes.
PHOENIX_OAUTH2_CONSENT_ORIGIN_CHECKOrigin-header enforcement on consent-page decisions, a defense against cross-site consent forgery. One of strict, off. Defaults to strict. Only relax this if a reverse proxy strips the Origin header and consent approvals fail.
PHOENIX_OAUTH2_DCR_RATE_LIMIT_PER_HOURMaximum dynamic client registrations accepted per IP address each hour. Defaults to 10.

Password Recovery#

Info

The password recovery methods described in this section apply when recovering a locally authenticated user’s password. In order recover a password for a user logged in via a third-party identity provider such as Google, you will have to consult the documentation of these identity providers

With SMTP (Simple Mail Transfer Protocol)#

Using SMTP ensures that your password recovery emails are delivered reliably and securely. SMTP is the standard protocol for sending emails, making sure that you receive the reset link promptly in your inbox.

Below is an example configuration to enable SMTP for sendgrid.

Without SMTP#

If SMTP is not configured, you have a few options to recover your forgotten password:

  • Contact an administrator and request that they reset your password. Admins can reset user passwords on the settings page.
  • As a last resort, you can manually update the database tuple that contains your password salt and hash.

Configuring OAuth2 Identity Providers#

Phoenix supports login via third-party identity providers (IDPs), including:

Info

OAuth2 enables applications such as Phoenix to authorize access to resources via identity providers (IDPs) rather than storing and verifying user credentials locally. OpenID Connect is an extension of OAuth2 that additionally authenticates users by verifying identity and providing Phoenix with user information such as email address, username, etc. Phoenix integrates with OpenID Connect IDPs that have a “well-known configuration endpoint” at GET /.well-known/openid-configuration, which provides a standardized way to discover information about the IDP’s endpoints and capabilities.

Phoenix uses the OAuth2 authorization code flow for web applications, which requires setting a few environment variables in addition to PHOENIX_ENABLE_AUTH and PHOENIX_SECRET:

Environment VariableDescription
PHOENIX_OAUTH2_<IDP>_CLIENT_IDThe client ID generated by the IDP when registering the application. (Required)
PHOENIX_OAUTH2_<IDP>_CLIENT_SECRETThe client secret generated by the IDP when registering the application. Required by default for confidential clients. Only optional when TOKEN_ENDPOINT_AUTH_METHOD is explicitly set to none (for public clients without client authentication) or client_assertion_jwt (where a platform-minted JWT is sent instead).
PHOENIX_OAUTH2_<IDP>_OIDC_CONFIG_URLThe URL to the OpenID Connect well-known configuration endpoint. Entering this URL in your browser will return a JSON object containing authorization server metadata. Must be HTTPS except for localhost. (Required)

Optional OAuth2 Configuration#

The following optional environment variables provide additional control over OAuth2 authentication behavior:

Environment VariableDescription
PHOENIX_OAUTH2_<IDP>_DISPLAY_NAMEA user-friendly name for the identity provider shown in the UI. If not set, Phoenix will generate a display name based on the IDP identifier.
PHOENIX_OAUTH2_<IDP>_ALLOW_SIGN_UPWhether to allow new user registration via this OAuth2 provider. Defaults to True. When set to False, only existing users can sign in. The system will check if the user exists in the database by their email address. If the user does not exist or has a password set (local auth), they will be redirected to the login page with an error message.
PHOENIX_OAUTH2_<IDP>_AUTO_LOGINAutomatically redirect to this provider’s login page, skipping the Phoenix login screen. Defaults to False. Useful for single sign-on deployments. Note: Only one provider should have AUTO_LOGIN enabled if you configure multiple IDPs.
PHOENIX_OAUTH2_<IDP>_USE_PKCEEnable PKCE (Proof Key for Code Exchange) with S256 code challenge method for enhanced security. PKCE protects the authorization code from interception and can be used with both public clients and confidential clients. This setting is orthogonal to client authentication—whether CLIENT_SECRET is required is determined solely by TOKEN_ENDPOINT_AUTH_METHOD, not by USE_PKCE. Defaults to False.
PHOENIX_OAUTH2_<IDP>_TOKEN_ENDPOINT_AUTH_METHODOAuth2 token endpoint authentication method. This setting determines how the client authenticates with the token endpoint and whether CLIENT_SECRET is required. If not set, defaults to requiring CLIENT_SECRET (confidential client). Options:
• client_secret_basic: Send credentials in HTTP Basic Auth header (most common). CLIENT_SECRET is required. This is the assumed default behavior if not set.
• client_secret_post: Send credentials in POST body (required by some providers). CLIENT_SECRET is required.
• none: No client authentication (for public clients). CLIENT_SECRET is not required. Use this for public clients that cannot securely store a client secret, typically in combination with PKCE.
• client_assertion_jwt: Authenticate with a JWT minted by the platform and sent as a client assertion (RFC 7523 §2.2), instead of a secret. CLIENT_SECRET is not required; exactly one of CLIENT_ASSERTION_FILE or CLIENT_ASSERTION_FILE_ENV_VAR is. Requires a provider that maps an external issuer onto the client — Microsoft Entra ID calls this a federated credential. See Workload identity without a client secret.

Most providers work with the default behavior. Set this explicitly only if your provider requires a specific method or if you’re configuring a public client.
PHOENIX_OAUTH2_<IDP>_SCOPESAdditional OAuth2 scopes to request (space-separated). These are added to the required baseline scopes openid email profile. For example, set to offline_access groups to request refresh tokens and group information. The baseline scopes are always included and cannot be removed.
PHOENIX_OAUTH2_<IDP>_EMAIL_ATTRIBUTE_PATHJMESPath expression to extract email from the OIDC ID token or userinfo endpoint response. Defaults to email (standard OIDC claim). See jmespath.org for full syntax.

When to use: Some identity providers (notably Microsoft Entra ID/Azure AD) may not populate the email claim for users who don’t have the mail attribute in their directory. In these cases, you can extract the User Principal Name (UPN) from preferred_username instead.

Common patterns:
• email (default) - standard OIDC email claim
• preferred_username - Azure AD/Entra ID UPN (recommended when email is null)
• upn - Azure AD UPN (requires optional claim configuration in Azure Portal)
• attributes.email - nested email structure

Values are automatically lowercased and trimmed before storage for consistent matching.
PHOENIX_OAUTH2_<IDP>_GROUPS_ATTRIBUTE_PATHJMESPath expression to extract group/role claims from the OIDC ID token or userinfo endpoint response. The path navigates nested JSON structures to find group/role information. This claim is checked from both the ID token and userinfo endpoint (if available). The result is normalized to a list of strings for group matching. See jmespath.org for full syntax.

⚠️ IMPORTANT: Claim keys with special characters (colons, dots, slashes, hyphens, etc.) MUST be enclosed in double quotes.

Common JMESPath patterns:
• Simple keys: groups - extracts top-level array
• Nested keys: resource_access.phoenix.roles - dot notation for nested objects
• Array projection: teams[*].name - extracts ‘name’ field from each object in array
• Array indexing: groups[0] - gets first element

Common provider examples:
• Google Workspace: groups
• Azure AD/Entra ID: roles or groups
• Keycloak: resource_access.phoenix.roles (nested structure)
• AWS Cognito: "cognito:groups" (use quotes for colon)
• Okta: groups
• Auth0 (custom namespace): "https://myapp.com/groups" (use quotes for special chars)
• Custom objects: teams[*].name (extract field from array of objects)

If not set, group-based access control is disabled for this provider.
PHOENIX_OAUTH2_<IDP>_ALLOWED_GROUPSComma-separated list of group names that are permitted to sign in. Users must belong to at least one of these groups (extracted via GROUPS_ATTRIBUTE_PATH) to authenticate successfully. Works together with GROUPS_ATTRIBUTE_PATH to implement group-based access control. If not set, all authenticated users can sign in (subject to ALLOW_SIGN_UP restrictions).

Example: PHOENIX_OAUTH2_OKTA_ALLOWED_GROUPS="admin,developers,viewers"

Note: Both GROUPS_ATTRIBUTE_PATH and ALLOWED_GROUPS must be configured together. If one is set, the other is required.
PHOENIX_OAUTH2_<IDP>_ROLE_ATTRIBUTE_PATHJMESPath expression to extract user role claim from the OIDC ID token or userinfo endpoint response. Similar to GROUPS_ATTRIBUTE_PATH but for extracting a single role value. See jmespath.org for full syntax.

⚠️ IMPORTANT: Claim keys with special characters MUST be enclosed in double quotes.
Examples: "https://myapp.com/role", "custom:role", user.profile."app-role"

Common patterns:
• Simple key: role - extracts top-level string
• Nested key: user.organization.role - dot notation for nested objects
• Array element: roles[0] - gets first role from array
• Constant value: 'MEMBER' - assigns a fixed role to all users from this IDP (notice the single quotes)
• Conditional logic: contains(groups[*], 'admin') && 'ADMIN' || 'VIEWER' - compute role from group membership using logical operators (returns Phoenix role directly, no mapping needed)

This claim is used with ROLE_MAPPING to automatically assign Phoenix roles (ADMIN, MEMBER, VIEWER) based on the user’s role in your identity provider. The extracted role value is matched against keys in ROLE_MAPPING to determine the Phoenix role.

Advanced: If the JMESPath expression returns a valid Phoenix role name (ADMIN, MEMBER, VIEWER) directly, ROLE_MAPPING is optional - the value will be used as-is after case-insensitive validation.

⚠️ Role Update Behavior:
• When ROLE_ATTRIBUTE_PATH IS configured: User roles are synchronized from the IDP on EVERY login. This ensures Phoenix roles stay in sync with your IDP’s role assignments.
• When ROLE_ATTRIBUTE_PATH is NOT configured: User roles are preserved as-is (backward compatibility). New users get VIEWER role (least privilege), existing users keep their current roles.
PHOENIX_OAUTH2_<IDP>_ROLE_MAPPINGMaps identity provider role values to Phoenix roles. Format: IdpRole1:PhoenixRole1,IdpRole2:PhoenixRole2

Phoenix roles (case-insensitive):
• ADMIN: Full system access, can manage users and settings
• MEMBER: Standard user access, can create and manage own resources
• VIEWER: Read-only access, cannot create or modify resources

Example mappings:
•PHOENIX_OAUTH2_OKTA_ROLE_MAPPING="Owner:ADMIN,Developer:MEMBER,Guest:VIEWER"
•PHOENIX_OAUTH2_KEYCLOAK_ROLE_MAPPING="admin:ADMIN,user:MEMBER"

⚠️ Security: The SYSTEM role cannot be assigned via OAuth2. Attempts to map to SYSTEM will be rejected.

Optional Behavior (no mapping required):
If ROLE_MAPPING is not configured but ROLE_ATTRIBUTE_PATH is set, the system will use the IDP role value directly if it exactly matches “ADMIN”, “MEMBER”, or “VIEWER” (case-insensitive). This allows IDPs that already use Phoenix’s role names to work without explicit mapping.

IDP role keys are case-sensitive and must match exactly. Phoenix role values are case-insensitive but will be normalized to uppercase (ADMIN, MEMBER, VIEWER). If a user’s IDP role is not in the mapping, behavior depends on ROLE_ATTRIBUTE_STRICT:
• strict=false (default): User gets VIEWER role (least privilege)
• strict=true: User is denied access

Works together with ROLE_ATTRIBUTE_PATH. If ROLE_ATTRIBUTE_PATH is set but ROLE_MAPPING is not, the IDP role value is used directly if it matches a valid Phoenix role (ADMIN, MEMBER, VIEWER). If the IDP role doesn’t match a valid Phoenix role, behavior depends on ROLE_ATTRIBUTE_STRICT.
PHOENIX_OAUTH2_<IDP>_ROLE_ATTRIBUTE_STRICTControls behavior when role cannot be determined from identity provider claims. Defaults to false.

When true:
• Missing role claim → access denied
• Role not in ROLE_MAPPING → access denied
• Empty/invalid role value → access denied

When false (default):
• Missing/unmapped/invalid role → user gets VIEWER role (least privilege, fail-safe)

Note: this VIEWER fail-safe applies to new users and to existing users whose roles are synced. If ROLE_RESYNC=false, existing users keep their current role even when their IDP role claim is missing or invalid, so the fail-safe downgrade does not apply to them.

Strict mode is recommended for high-security environments where all users must have explicitly assigned roles. Non-strict mode (default) is more forgiving and suitable for gradual rollout of role mapping.

Example: PHOENIX_OAUTH2_OKTA_ROLE_ATTRIBUTE_STRICT=true

Note: This setting only applies when ROLE_ATTRIBUTE_PATH is configured. If ROLE_ATTRIBUTE_PATH is not set, this setting is ignored.
PHOENIX_OAUTH2_<IDP>_ROLE_RESYNCControls whether existing users’ roles are re-synchronized from the IDP on every login. Defaults to true.

When true (default): If ROLE_ATTRIBUTE_PATH is configured, an existing user’s role is overwritten from IDP claims on every login (the IDP is the source of truth).

When false: An existing user’s role is never overwritten from IDP claims. New users are still created with their IDP-mapped role, so role mapping stays active for provisioning, but existing users keep their current Phoenix role on re-login.

Set this to false when you want IDP-based role mapping to provision new users while still being able to promote or demote specific users from within Phoenix. Example: PHOENIX_OAUTH2_OKTA_ROLE_RESYNC=false

⚠️ Security: With this disabled (false), Phoenix becomes the source of truth for existing users’ roles. Revoking a user’s role at the IDP (removing the role claim or the group that maps to it) will not automatically demote them in Phoenix — including the non-strict VIEWER fail-safe. You must deprovision or downgrade such users manually in the Phoenix admin UI.

Note: This setting only applies when ROLE_ATTRIBUTE_PATH is configured. Setting it to false without ROLE_ATTRIBUTE_PATH is rejected at startup, since there is no role sync to disable.
PHOENIX_OAUTH2_<IDP>_CLIENT_ASSERTION_FILEAbsolute path to a file holding the JWT sent as the client assertion. Only used when TOKEN_ENDPOINT_AUTH_METHOD is client_assertion_jwt, where exactly one of this and CLIENT_ASSERTION_FILE_ENV_VAR is required — setting both is an error.

The file is re-read on every token request, so a platform that rotates the token needs no restart. Relative paths are rejected, since they would resolve against a working directory the deployment does not pin.
PHOENIX_OAUTH2_<IDP>_CLIENT_ASSERTION_FILE_ENV_VARThe name of an environment variable holding that path — not the path, and not the assertion. Use this when the platform owns the location and may move it.

On AKS set it to AZURE_FEDERATED_TOKEN_FILE, which the Azure Workload Identity webhook exports alongside the token it projects. Naming the variable rather than the path keeps the deployment working if the webhook relocates it, which it has done between releases.

The variable is named per provider rather than discovered automatically: it is process-global, so reading it implicitly would send the same assertion to every configured provider, including ones it was not issued for.
Warning

Group-based access control requirements:

  • If you set ALLOWED_GROUPS, you must also set GROUPS_ATTRIBUTE_PATH to extract groups from the ID token.
  • If you set GROUPS_ATTRIBUTE_PATH, you must also set ALLOWED_GROUPS to specify which groups are allowed.
  • Group-based access control is evaluated per-provider: if a user authenticates via an IDP with ALLOWED_GROUPS configured, they must belong to one of those groups to sign in.

Role mapping configuration:

  • ROLE_ATTRIBUTE_PATH and ROLE_MAPPING work together to automatically assign Phoenix roles based on IDP roles.
  • If ROLE_ATTRIBUTE_PATH is configured, user roles are synchronized from the IDP on every login — unless ROLE_RESYNC is disabled (false), in which case existing users keep their current Phoenix roles (new users are still provisioned with their mapped role).
  • If ROLE_ATTRIBUTE_PATH is not configured, new OAuth2 users get the VIEWER role by default and existing users keep their current roles.
  • Set ROLE_RESYNC=false to keep role mapping active for provisioning while letting admins manage individual users’ roles from the Phoenix UI without being overwritten on the next login.
  • Groups control access (who can sign in), while roles control permissions (what users can do).

Where Phoenix Reads Group and Role Claims#

GROUPS_ATTRIBUTE_PATH and ROLE_ATTRIBUTE_PATH are evaluated against the claims Phoenix receives at login as an OpenID Connect client: the verified ID token and the UserInfo response. Phoenix checks the ID token first and, when a configured claim is missing there, fetches the UserInfo endpoint and checks the response.

Warning

The group/role claim must be present on the ID token or the UserInfo response. This is an identity-provider setting, not a Phoenix one. If your IdP places authorization data (groups, roles) only on the OAuth2 access token, Phoenix will not see it. What happens then depends on your configuration: when group-based access control (GROUPS_ATTRIBUTE_PATH + ALLOWED_GROUPS) is enabled, a missing group claim denies sign-in; for role mapping, a missing role claim falls back to VIEWER in non-strict mode (the default) but denies sign-in when ROLE_ATTRIBUTE_STRICT=true.

Phoenix uses the access token solely as a bearer credential to call the UserInfo endpoint; it does not decode the access token to read claims. Per RFC 9068 §6, OAuth2 clients are directed to treat access tokens as opaque, so the supported claim surfaces for a sign-in application are the ID token and UserInfo.

Keeping authorization claims off the ID token. If your security policy is to keep authorization data out of the ID token, the UserInfo response is a fully supported target. Configure your IdP to return the group/role claim from UserInfo (rather than embedding it in every ID token), request the appropriate scope, and point GROUPS_ATTRIBUTE_PATH / ROLE_ATTRIBUTE_PATH at the claim. When a configured claim is absent from the ID token, Phoenix fetches UserInfo with the access token during login, so a claim exposed only through UserInfo is still picked up — with no access-token decoding involved.

Provider claim configuration. Exposing the claim is done in your IdP’s console. Common starting points (consult each provider’s current docs for exact steps):

  • Okta — request the groups scope from Phoenix (PHOENIX_OAUTH2_OKTA_SCOPES=groups) and add a groups claim. On the org authorization server, configure the app’s Groups claim and filter; on a custom authorization server, add the claim under Security → API → Authorization Servers → (your server) → Claims. To return the claim through UserInfo (instead of forcing it into every ID token), choose the Userinfo/id_token request option. See Okta’s groups claim guide and custom claims docs.
  • Auth0 — add a namespaced custom claim to the ID token from a Post-Login Action with api.idToken.setCustomClaim(...).
  • Microsoft Entra ID (Azure AD) — configure the optional groups claim (or app-role roles) in the app registration’s Token configuration, with handling for group overage on large group lists.
  • Keycloak — add a Group Membership or role mapper to the client or client scope with Add to ID token and/or Add to userinfo enabled.
Tip

Troubleshooting: unexpected VIEWER role or denied sign-in. Both symptoms usually mean the configured claim isn’t reaching the ID token or UserInfo response — a missing role claim falls back to VIEWER in non-strict mode, while a missing group claim denies sign-in when group access control is enabled (as does a missing role claim under ROLE_ATTRIBUTE_STRICT=true). Check that (1) Phoenix requests the scope that releases the claim (e.g. groups for Okta), (2) the claim is configured for the ID token or UserInfo on the IdP side, and (3) your JMESPath path matches the claim’s actual key and shape. A claim that exists only on the access token will not be visible to Phoenix.

Multiple Identity Providers#

You can configure multiple IDPs simultaneously by setting environment variables for each provider with different IDP identifiers. Users will see all configured providers as login options on the Phoenix login page. Each IDP is configured independently with its own set of variables.

Example with both Google and Okta:

Common OAuth2 Configuration Examples#

Public client with PKCE (no client secret):

Info

PKCE support requires Phoenix 12.4.0 or later.

With nested group path (Keycloak):

With special characters in path (AWS Cognito - quotes REQUIRED):

With namespaced claims (Auth0 - quotes REQUIRED):

With array projection (extract names from objects):

Single sign-on with auto-login:

With custom email attribute path (Azure AD/Entra ID without email claim):

Info

This is useful when Azure AD users don’t have the mail attribute populated in their directory. The preferred_username claim contains the User Principal Name (UPN), which is always in email format (e.g., user@company.onmicrosoft.com).

With role mapping (simple):

With role mapping (nested path for Keycloak):

With role mapping in strict mode (deny unmapped roles):

With conditional logic to compute role from groups (no mapping needed):

With both groups and roles (groups control access, roles control permissions):

With a fixed role for all users from an IDP

With role mapping for provisioning, but admin-managed roles thereafter

Info

Default role behavior:

  • If ROLE_ATTRIBUTE_PATH is not configured: New OAuth2 users are initially added as VIEWER (least privilege). Their role can be changed after their first login by a Phoenix admin. Existing users keep their current roles.
  • If ROLE_ATTRIBUTE_PATH is configured: User roles are automatically synchronized from the IDP on every login based on the role mapping configuration, unless ROLE_RESYNC=false, which preserves existing users’ current Phoenix roles while still provisioning new users from the IDP.

Detailed instructions for common IDPs are provided below.

Google#

  1. In Google Cloud Console, select a GCP project in which to register your Phoenix OAuth2 app.
  2. Select APIs and Services.
  3. In the Credentials page, click on Create Credentials and select OAuth Client ID.
  4. From the Application type dropdown, select Web application.
  5. Enter a name for your Phoenix app, which will be displayed to users when signing in.
  6. Under Authorized JavaScript origins, click Add URI and enter the origin URL where you will access Phoenix in the browser.
  7. Under Authorized redirect URIs, click Add URI. Take the URL from the previous step and append the slug /oauth2/google/tokens. Alternatively, if you have configured a root path via the PHOENIX_HOST_ROOT_PATH environment variable, append a slug of the form /<root-path>/oauth2/google/tokens. Enter the resulting URL.
  8. Copy your client ID and client secret.
  9. Deploy Phoenix with the three environment variables described above, substituting GOOGLE for <IDP>. The well-known configuration endpoint is https://accounts.google.com/.well-known/openid-configuration.

AWS Cognito#

  1. In the AWS Management Console, navigate to the Cognito page.
  2. From the User Pools page, select Create User Pool.
  3. Under Required attributes, in the Additional required attributes dropdown, select email (you can optionally require name and picture to ensure user profiles have this information in Phoenix).
  4. In the Initial app client section:
    1. Under App type, select Confidential client.
    2. Under App client name, enter a name for your Phoenix app.
    3. Under Client secret, ensure Generate a client secret is selected.
  5. Create your user pool and navigate to the page for the newly created user pool by clicking on its name.
  6. Add at least one user to your user pool in the Users section.
  7. Copy and save your user pool ID from the top of the page. The ID should be of the form <region>_<hash>, e.g., us-east-2_x4FTon498.
  8. Under App Integration > Domain, create a domain to contain the sign-in page and OAuth2 endpoints.
  9. Under App Integration > App client list > App clients and analytics, select your newly created client.
  10. Copy and save your client ID and client secret.
  11. Under Hosted UI, click Edit. On the Edit Hosted UI page:
    1. Add an Allowed callback URL of the form <origin-url>/oauth2/aws_cognito/tokens, where <origin-url> is the URL where you will access Phoenix in the browser. Alternatively, if you have configured a root path via the PHOENIX_HOST_ROOT_PATH environment variable, your callback URL will have the form <origin-url>/<root-path>/oauth2/aws_cognito/tokens.
    2. In the Identity Providers dropdown, select Cognito user pool.
    3. Under OAuth 2.0 grant types, select Authorization code grant.
    4. Under OpenID Connect scopes, select OpenID, Email, and Profile.
    5. Save your changes.
  12. The well-known configuration endpoint is of the form https://cognito-idp.<region>.amazonaws.com/<user-pool-id>/.well-known/openid-configuration, where the user pool ID was copied in a previous step and the region is the first part of the user pool ID preceding the underscore. Test this URL in your browser to ensure it is correct before proceeding to the next step.
  13. Deploy Phoenix using the three environment variables described above, substituting AWS_COGNITO for <IDP>.

Microsoft Entra ID#

  1. From the Azure portal, navigate to Microsoft Entra ID.
  2. Select Add > App Registration.
  3. On the Register an Application page:
    1. Enter a name for your application.
    2. Under Redirect URI, in the Select a platform dropdown, select Web and a redirect URI of the form <origin-url>/oauth2/microsoft_entra_id/tokens, where <origin-url> is the URL where you will access Phoenix in the browser. Alternatively, if you have configured a root path via the PHOENIX_HOST_ROOT_PATH environment variable, your redirect URI will have the form <origin-url>/<root-path>/oauth2/microsoft_entra_id/tokens.
  4. Copy and save the Application (client) ID.
  5. Under Endpoints, copy and save the well-known configuration endpoint under OpenID Connect metadata document.
  6. Under Client credentials, click Add a certificate or secret. Create a client secret and copy and save its value.
  7. Deploy Phoenix using the three environment variables described above, substituting MICROSOFT_ENTRA_ID for <IDP>.
Tip

Missing email claim? If your users see “Missing or invalid ‘email’ claim” errors, their directory entries may not have the mail attribute populated. Set PHOENIX_OAUTH2_MICROSOFT_ENTRA_ID_EMAIL_ATTRIBUTE_PATH=preferred_username to use the User Principal Name (UPN) instead, which is always available and in email format.

Workload identity without a client secret#

On Kubernetes, Phoenix can authenticate to Entra ID with the pod’s projected service account token instead of a client secret, so no long-lived credential exists to store or rotate. Entra trusts the cluster’s OIDC issuer through a federated credential, and Phoenix relays the projected token as a client assertion (RFC 7523 §2.2).

This replaces step 6 above — create no client secret.

  1. Install the Azure Workload Identity webhook on the cluster.

  2. On the app registration, under Certificates & secrets → Federated credentials, add a credential of scenario Kubernetes accessing Azure resources:

    • Cluster issuer URL — your AKS OIDC issuer, from az aks show --query oidcIssuerProfile.issuerUrl.
    • Namespace and Service account name — where Phoenix runs.
    • Subject identifier — system:serviceaccount:<namespace>:<serviceAccountName>.
  3. Label the Phoenix pods so the webhook projects a token into them. With the Helm chart:

  4. Configure the provider with no secret:

    AZURE_FEDERATED_TOKEN_FILE is exported by the webhook and holds the path to the projected token. Phoenix is given the variable’s name rather than the path, because the webhook owns that location and has moved it between releases.

At startup Phoenix logs which variable each provider resolved through:

If the pod label is missing the webhook projects nothing, and startup fails with a message naming both the variable and the label.

Note

This is not limited to Entra ID or to Azure — any provider that maps an external issuer onto a client, and any platform that writes a JWT to a file, works the same way. Set CLIENT_ASSERTION_FILE to an absolute path instead of naming a variable when the location is fixed and you control it. A provider implementing only plain RFC 7523, where the assertion must be signed with the client’s own registered key, will reject a cluster-minted token.

Keycloak#

  1. From the Keycloak Console create a new Realm or skip this part if you want to reuse a existing Realm
  2. Select Clients.
  3. Click on new Client
    1. Enter the Client ID phoenix
    2. Enter the Name Phoenix Client
    3. Enter below Root URL the root url of your phoenix instance, like https://example.com/subpath/subpath
    4. Enter below Home URL the home url of your phoenix instance, like /subpath/subpath
    5. Enter below Valid redirect URIs a redirect url to your phoenix instance, like https://example.com/subpath/subpath/*
    6. Enter below Valid post logout redirect URIs +
    7. Enter below Web origins your url, like https://example.com
    8. Enter below Admin URL your admin url, like https://example.com/subpath/subpath/
    9. Enable Client authentication
    10. Ensure that only Standard flow and Direct access grants is enabled
    11. Hit the Save button
  4. Go to the Client phoenix and to the tab credentials and copy the client-secret
  5. Deploy Phoenix using the three environment variables described above, substituting KEYCLOAK for <IDP>:

Other Identity Providers#

Phoenix can integrate with any OAuth2 IDP that supports OpenID Connect and has a well-known configuration endpoint. Detailed instructions will vary by IDP, but the general steps remain the same:

  1. Register a Phoenix client application with your IDP. If prompted to select an application type, select traditional web application or a similarly named application type that allows you to generate a client secret in addition to a client ID.
  2. Find the well-known configuration endpoint for your IDP.
  3. Deploy Phoenix with the environment variables described above, substituting <IDP> with your IDP name, e.g., AUTH0. If you have configured a root path via the PHOENIX_HOST_ROOT_PATH environment variable, ensure that the root path is included in the path of your callback URL.
  4. Use the optional configuration variables documented above to customize behavior such as display names, sign-up policies, group-based access control, and more.

Configuring LDAP Authentication#

Phoenix supports authentication against LDAP directories, including:

  • Microsoft Active Directory
  • OpenLDAP
  • 389 Directory Server
  • Any LDAP v3 compliant directory

LDAP authentication allows users to log in with their corporate directory credentials, enabling centralized user management and integration with existing identity infrastructure.

Info

LDAP (Lightweight Directory Access Protocol) is the industry-standard protocol for accessing directory services. Phoenix uses LDAP to authenticate users against your corporate directory and optionally map directory groups to Phoenix roles.

Info

LDAP support requires Phoenix 12.20.0 or later.

Required LDAP Configuration#

To enable LDAP authentication, set the following environment variables in addition to PHOENIX_ENABLE_AUTH and PHOENIX_SECRET:

Environment VariableDescription
PHOENIX_LDAP_HOSTLDAP server hostname or IP address. Comma-separated for multiple servers with automatic failover. (Required)

Examples:
• Single server: ldap.corp.example.com
• Multiple servers: dc1.corp.com,dc2.corp.com,dc3.corp.com
PHOENIX_LDAP_USER_SEARCH_BASE_DNSJSON array of base DNs (Distinguished Names) for user searches. Phoenix searches each base DN in order until a user is found. (Required)

Examples:
• Active Directory: [“OU=Users,DC=corp,DC=example,DC=com”]
• OpenLDAP: [“ou=people,dc=example,dc=com”]
PHOENIX_LDAP_GROUP_ROLE_MAPPINGSJSON array mapping LDAP groups to Phoenix roles. Must contain at least one mapping (Phoenix will fail to start if empty).

Example (grant all authenticated LDAP users MEMBER): [{“group_dn”:”*”,“role”:“MEMBER”}]
PHOENIX_LDAP_ATTR_EMAILLDAP attribute containing the user’s email address (e.g., mail). Set to null to enable authentication without email (see warning below for additional required settings).

Optional LDAP Configuration#

Environment VariableDescription
PHOENIX_LDAP_PORTLDAP server port. Defaults to 389 for StartTLS or 636 for LDAPS based on PHOENIX_LDAP_TLS_MODE.
PHOENIX_LDAP_TLS_MODETLS connection mode. Options:
• starttls (default): Upgrade plaintext connection to TLS on port 389
• ldaps: TLS from connection start on port 636
• none: No encryption (testing only, credentials sent in plaintext)
PHOENIX_LDAP_TLS_VERIFYVerify server TLS certificates. Defaults to true. Should always be true in production to prevent MITM attacks.
PHOENIX_LDAP_TLS_CA_CERT_FILEPath to custom CA certificate file (PEM format) for TLS verification. Use when your LDAP server uses a private/internal CA not in the system trust store.

Example: /etc/ssl/certs/internal-ca.pem
PHOENIX_LDAP_TLS_CLIENT_CERT_FILEPath to client certificate file (PEM format) for mutual TLS authentication. Requires PHOENIX_LDAP_TLS_CLIENT_KEY_FILE to also be set.
PHOENIX_LDAP_TLS_CLIENT_KEY_FILEPath to client private key file (PEM format) for mutual TLS authentication. Requires PHOENIX_LDAP_TLS_CLIENT_CERT_FILE to also be set.
PHOENIX_LDAP_BIND_DNService account DN for binding to the LDAP server. Optional. When set, PHOENIX_LDAP_BIND_PASSWORD must also be set.

Example: CN=svc-phoenix,OU=Service Accounts,DC=corp,DC=com
PHOENIX_LDAP_BIND_PASSWORDService account password for binding to the LDAP server. Should be stored securely (e.g., in a Kubernetes Secret).
PHOENIX_LDAP_USER_SEARCH_FILTERLDAP filter for finding users. Use %s as placeholder for the username.

Defaults to Active Directory format: (&(objectClass=user)(sAMAccountName=%s))

OpenLDAP example: (&(objectClass=inetOrgPerson)(uid=%s))
PHOENIX_LDAP_ATTR_DISPLAY_NAMELDAP attribute containing user’s display name. Defaults to displayName.
PHOENIX_LDAP_ATTR_MEMBER_OFLDAP attribute containing group memberships. Defaults to memberOf. Used when PHOENIX_LDAP_GROUP_SEARCH_FILTER is not set (Active Directory mode).
PHOENIX_LDAP_ATTR_UNIQUE_IDLDAP attribute containing an immutable unique identifier. Required when PHOENIX_LDAP_ATTR_EMAIL is null (users are identified by this ID instead of email). Also recommended if you expect user emails to change frequently (e.g., due to name changes or company rebranding).

Options:
• Active Directory: objectGUID
• OpenLDAP: entryUUID
• 389 DS: nsUniqueId
PHOENIX_LDAP_GROUP_SEARCH_BASE_DNSJSON array of base DNs for group searches. Required when PHOENIX_LDAP_GROUP_SEARCH_FILTER is set.

Example: [“ou=groups,dc=example,dc=com”]
PHOENIX_LDAP_GROUP_SEARCH_FILTERLDAP filter for finding groups containing a user. Use %s as placeholder for the user identifier.

Two modes:
• AD Mode (not set, recommended for Active Directory): Reads the memberOf attribute directly from the user entry. AD automatically populates this.
• Search Mode (set): Searches for groups in PHOENIX_LDAP_GROUP_SEARCH_BASE_DNS. Required for POSIX groups (posixGroup) or when memberOf is unavailable.

Example: (&(objectClass=posixGroup)(memberUid=%s))
PHOENIX_LDAP_GROUP_SEARCH_FILTER_USER_ATTRLDAP attribute from the user entry to substitute for %s in PHOENIX_LDAP_GROUP_SEARCH_FILTER. Only used when PHOENIX_LDAP_GROUP_SEARCH_FILTER is set.

When set: Reads the specified attribute from the user’s LDAP entry
When not set (default): Uses the login username directly

Understanding group membership attributes:
• POSIX groups (memberUid): Contains usernames like “jdoe”. Use default (login username) or uid.
• groupOfNames (member): Contains full DNs. Requires distinguishedName (Active Directory only—OpenLDAP does not expose DN as an attribute).

Common values:
• Not set (default): Uses login username (works for POSIX groups)
• uid: Explicitly use uid attribute
• distinguishedName: Full DN (Active Directory only)
PHOENIX_LDAP_ALLOW_SIGN_UPAllow automatic user creation on first LDAP login. Defaults to true. Set to false to require pre-provisioned users (created via PHOENIX_ADMINS or the UI before first login). Note: Setting to false requires email to be configured (PHOENIX_LDAP_ATTR_EMAIL), as pre-provisioned users are matched by email address.
Warning

LDAP Directories Without Email Addresses

If your LDAP directory does not have the mail attribute (or any email attribute), set PHOENIX_LDAP_ATTR_EMAIL=null to enable authentication without email. When this mode is enabled:

  • PHOENIX_LDAP_ATTR_UNIQUE_ID is required — users are identified by this immutable ID instead of email
  • PHOENIX_LDAP_ALLOW_SIGN_UP must be true — users are auto-provisioned on first login (pre-provisioning by email is not possible without email addresses)
  • PHOENIX_ADMINS cannot be used — use PHOENIX_LDAP_GROUP_ROLE_MAPPINGS to assign admin roles instead
  • Users will appear in Phoenix without email addresses — the UI will display username instead of email where applicable

Active Directory Configuration Example#

OpenLDAP Configuration Example#

Active Directory with Nested Groups#

For Active Directory environments using nested groups with the member attribute (which contains full DNs):

Info

Recommended approach: Start with the simpler AD Mode (read the user’s memberOf attribute; leave PHOENIX_LDAP_GROUP_SEARCH_FILTER unset). This is usually easiest to configure, but it typically only includes the user’s direct group memberships (not “group-in-group” / nested groups).

If your authorization relies on nested groups, use search mode with Active Directory’s LDAP_MATCHING_RULE_IN_CHAIN (OID 1.2.840.113556.1.4.1941) as shown below, or flatten group memberships in AD.

LDAP with Multiple Servers (Failover)#

For high availability, configure multiple LDAP servers:

Phoenix will try each server in order until a successful connection is established.

Warning

Multi-server failover behavior:

Phoenix assumes all configured servers are replicas with identical user sets. Failover only occurs on connection errors:

ConditionBehavior
Server unreachable / timeout✅ Tries next server
User not found❌ Returns immediately (no failover)
Invalid password❌ Returns immediately (no failover)

Not supported: Multi-domain or multi-forest Active Directory configurations where different users exist on different servers. In these environments, users can only authenticate against the first reachable server that contains their account.

This design provides faster authentication, better security (no probing of multiple servers), and avoids masking infrastructure issues like replication lag.

LDAP with Custom CA Certificate#

When your LDAP server uses a certificate signed by an internal CA:

LDAP with Mutual TLS (Client Certificates)#

For environments requiring client certificate authentication:

Disabling Password Authentication (LDAP-Only)#

To require all users to authenticate via LDAP and disable local password authentication:

Warning

LDAP Security Best Practices:

  • Always use TLS encryption (PHOENIX_LDAP_TLS_MODE=starttls or ldaps) in production
  • Always verify TLS certificates (PHOENIX_LDAP_TLS_VERIFY=true) in production
  • Store the bind password securely (e.g., Kubernetes Secrets, HashiCorp Vault)
  • Use a dedicated service account with minimal read-only permissions
  • Configure group role mappings to follow the principle of least privilege
Info

User Identity: By default, Phoenix identifies LDAP users by their email address. Configure PHOENIX_LDAP_ATTR_UNIQUE_ID to use an immutable identifier like objectGUID (Active Directory) or entryUUID (OpenLDAP) if:

  • Your LDAP directory does not have email addresses (set PHOENIX_LDAP_ATTR_EMAIL=null)
  • You expect user emails to change frequently (e.g., due to company rebranding or name changes)

Advanced Authentication Configuration#

The following optional environment variables provide additional control over authentication behavior for advanced use cases:

VariableDescription
PHOENIX_ADMIN_SECRETA secret key that can be used as a bearer token instead of an API key. It authenticates as the first system user (admin). This key must be at least 32 characters long, include at least one digit and one lowercase letter, and must be different from PHOENIX_SECRET. Additionally, it must not be set if PHOENIX_SECRET is not configured.

Usage: Authorization: Bearer <PHOENIX_ADMIN_SECRET>
PHOENIX_DISABLE_BASIC_AUTHForbid login via password and disable the creation of local users, which log in via passwords. This can be helpful in setups where authentication is handled entirely through OAuth2. Defaults to False.
PHOENIX_DISABLE_BRUTE_FORCE_LOGIN_PROTECTIONDisable brute force login protection. Defaults to false. Use with caution as this removes protection against repeated failed login attempts.
PHOENIX_BRUTE_FORCE_LOGIN_PROTECTION_MAX_ATTEMPTSMaximum number of failed login attempts before temporary lockout. Defaults to 5. Lockout duration is 5 minutes.
PHOENIX_ACCESS_TOKEN_EXPIRY_MINUTESThe duration, in minutes, before access tokens expire. Defaults to the system default if not specified.
PHOENIX_REFRESH_TOKEN_EXPIRY_MINUTESThe duration, in minutes, before refresh tokens expire. Defaults to the system default if not specified.
PHOENIX_PASSWORD_RESET_TOKEN_EXPIRY_MINUTESThe duration, in minutes, before password reset tokens expire. Defaults to the system default if not specified.
PHOENIX_ADMINSA semicolon-separated list of username and email address pairs to create as admin users on startup. The format is username=email, e.g., John Doe=john@example.com;Doe, Jane=jane@example.com. The password for each user will be randomly generated and will need to be reset. The application will not start if this environment variable is set but cannot be parsed or contains invalid emails. If the username or email address already exists in the database, the user record will not be modified. Changing this environment variable for the next startup will not undo any records created in previous startups.
PHOENIX_ROOT_URLThis is the full URL used to access Phoenix from a web browser. This setting is important when you have a reverse proxy in front of Phoenix. If the reverse proxy exposes Phoenix through a sub-path, add that sub-path to the end of this URL setting.

⚠️ WARNING: When a sub-path is needed, you must also specify the sub-path via the environment variable PHOENIX_HOST_ROOT_PATH. Setting just this URL setting is not enough.

Examples:
• With a sub-path: https://example.com/phoenix
• Without a sub-path: https://phoenix.example.com
PHOENIX_MANAGEMENT_URLThe URL to use for redirecting to a management interface that may be hosting Phoenix. If set, and the current user is within PHOENIX_ADMINS, a link will be added to the navigation menu to return to this URL.