Skip to main content

Auth and Accounts

These variables tell Claude Code who you are. They carry API keys, bearer tokens, OAuth data, and the commands that fetch credentials for you. Put secrets in your shell or a secrets manager, not in a file you commit.

This page lists 79 variables. ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN are the common ones. Run /login for a stored login. Project settings cannot set some of them before you trust the folder.

Example​

export ANTHROPIC_API_KEY="sk-ant-your-key"
claude

Claude Code sends the key as the x-api-key header.

Variables​

The table is sorted by name. See Environment Variables for what each column and badge means.

VariableStatusWhat it doesValues and defaultNotes
ANTHROPIC_API_KEY
Documented: An official docs page names this item.
Sets the API key that Claude Code sends to the API. It takes precedence over a profile sign-in.TextAll sessions. Not set from project env before trust
ANTHROPIC_AUTH_TOKEN
Documented: An official docs page names this item.
Sets the Authorization header to Bearer plus the value. It also counts as a credential for gateway model discovery.Text. Claude Code reads it on each accessAll sessions. Not set from project env before trust
ANTHROPIC_AWS_API_KEY
Documented: An official docs page names this item.
Sets the workspace API key for Claude Platform on AWS. When it is set, Claude Code skips the AWS credential chain for that client.Text. The code removes it for a moment while it builds a client that uses the AWS chainProvider anthropicAws. Not set from project env before trust
ANTHROPIC_CONFIG_DIR
Documented: An official docs page names this item.
Sets the directory for Anthropic profile files. Claude Code reads configs and credentials files from it.Text. Wins over XDG_CONFIG_HOME. Claude Code does not use it when a helper returns null for the current modeProfile and federation sign-in, all. Not set from project env before trust
ANTHROPIC_FEDERATION_RULE_ID
Documented: An official docs page names this item.
Gives the federation rule ID for workload identity federation. With ANTHROPIC_ORGANIZATION_ID it selects the env-quad federation credential.Text. ANTHROPIC_WORKSPACE_ID is an optional third valueAll sessions. Not set from project env before trust
ANTHROPIC_FOUNDRY_API_KEY
Documented: An official docs page names this item.
Gives the API key for Microsoft Foundry. When it is set, Claude Code does not build the Azure default credential.Text. The Foundry client reads the key. ANTHROPIC_FOUNDRY_AUTH_TOKEN wins over itProvider foundry. Project env can set it before trust
ANTHROPIC_FOUNDRY_AUTH_TOKEN
Documented: An official docs page names this item.
Gives the bearer token for Microsoft Foundry. It wins over the API key and over the Azure default credential.Text. The token provider returns it on each requestProvider foundry. Not set from project env before trust
ANTHROPIC_IDENTITY_TOKEN
Documented: An official docs page names this item.
The bundled SDK uses it as the OIDC identity token for workload identity federation when no config file gives one.Text. Used with ANTHROPIC_FEDERATION_RULE_ID and ANTHROPIC_ORGANIZATION_ID. The name is also in a list of secret-like env namesBundled SDK federation sign-in. Not set from project env before trust
ANTHROPIC_IDENTITY_TOKEN_FILE
Documented: An official docs page names this item.
The bundled SDK reads the OIDC identity token from this file path for workload identity federation.Text. It becomes identity_token with source file. The SDK uses it when the org ID and rule ID are set and no config file existsBundled SDK federation sign-in. Not set from project env before trust
ANTHROPIC_ORGANIZATION_ID
Documented: An official docs page names this item.
Gives the organization ID for workload identity federation. Set it with ANTHROPIC_FEDERATION_RULE_ID.Text. Together they form the env-quad federation identity. The SDK also reads it as a fallbackAll sessions. Not set from project env before trust
ANTHROPIC_PROFILE
Documented: An official docs page names this item.
Names the Anthropic profile to sign in with.Text, profile by default. An explicit value makes the profile mode profile-explicitAll sessions. Not set from project env before trust
ANTHROPIC_SCOPE
Undocumented: Only the program shows this item. It can change without notice.
The bundled SDK sends it as the OAuth scope in workload identity federation. A config file value wins.Text. Fills authentication.scope when the config does not set itBundled SDK federation sign-in. Not set from project env before trust
ANTHROPIC_SERVICE_ACCOUNT_ID
Undocumented: Only the program shows this item. It can change without notice.
The bundled SDK uses it as service_account_id in workload identity federation.Text. Fills authentication.service_account_id when the config does not set itBundled SDK federation sign-in. Not set from project env before trust
ANTHROPIC_WORKSPACE_ID
Documented: An official docs page names this item.
Gives the workspace ID for workload identity federation. It is optional in the env-quad identity.Text. The SDK also reads it as a fallbackAll sessions. Not set from project env before trust
AWS_BEARER_TOKEN_BEDROCK
Documented: An official docs page names this item.
Gives the Amazon Bedrock API key. Claude Code sends it as a Bearer token and skips the AWS credential chain.Text. Used for Bedrock and Mantle clientsProviders bedrock and mantle. Not set from project env before trust
CLAUDE_BG_AUTH_SNAPSHOT_PATH
Undocumented: Only the program shows this item. It can change without notice.
Points to a JSON file with a gateway token or access token for a background session.Text. Claude Code reads the file once. Then it deletes the file. Then it removes the var. It retries if the file is busyBackground sessions. Not set from project env before trust
CLAUDE_BG_CLAIM_AUTH
Undocumented: Only the program shows this item. It can change without notice.
Carries the claim token for a spare background session.Text. A tokens file can replace itSpare background sessions. Not set from project env before trust
CLAUDE_BG_DISPATCHER_RATE_LIMIT_TIER
Undocumented: Only the program shows this item. It can change without notice.
Passes the rate limit tier of the dispatcher account to a background session.Text. Used only when CLAUDE_CODE_SESSION_KIND is bg. The dispatcher sets itBackground sessions. Not set from project env before trust
CLAUDE_BG_DISPATCHER_SUBSCRIPTION_TYPE
Undocumented: Only the program shows this item. It can change without notice.
Passes the subscription type of the dispatcher account to a background session.Text. Used only when CLAUDE_CODE_SESSION_KIND is bg. The dispatcher sets itBackground sessions. Not set from project env before trust
CLAUDE_BG_PTY_AUTH
Undocumented: Only the program shows this item. It can change without notice.
Holds the shared secret for the PTY link of a background session.Text. Claude Code generates and sets it. In exec mode, Claude Code removes it from the child envBackground sessions. Not set from project env before trust
CLAUDE_BG_RV_AUTH
Undocumented: Only the program shows this item. It can change without notice.
Holds the shared secret for the rendezvous socket of a background session.Text. Claude Code sets it. The session reads it once. Then it deletes itBackground sessions. Not set from project env before trust
CLAUDE_BG_SOCKET_TOKENS_PATH
Undocumented: Only the program shows this item. It can change without notice.
Points to a tokens file with the rendezvous and claim secrets for a background session.Text. Claude Code reads the file once. Then it deletes the file. Then it removes the varBackground sessions. Not set from project env before trust
CLAUDE_CODE_ACCOUNT_UUID
Documented: An official docs page names this item.
Gives the account UUID when the host supplies the account. It fills account info and telemetry ids.Text. With CLAUDE_CODE_USER_EMAIL and CLAUDE_CODE_ORGANIZATION_UUID it builds the account record in some host modesHost-managed and SDK sessions. Not set from project env before trust
CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR
Undocumented: Only the program shows this item. It can change without notice.
Names a file descriptor from which Claude Code reads the API key at startup.A number. A reader function runs at startup when it is set. The debug auth dump shows if it is setSDK and host launches. Not set from project env before trust
CLAUDE_CODE_API_KEY_HELPER_TTL_MS
Documented: An official docs page names this item.
Sets how often Claude Code refreshes credentials from apiKeyHelper.A number of milliseconds, stays by default. Whole number of 0 or more. A negative value logs an error. The built-in default then staysAll sessions with apiKeyHelper. Project env can set it before trust
CLAUDE_CODE_ARTIFACTS_API_TOKEN
Undocumented: Only the program shows this item. It can change without notice.
Gives a bearer token for requests to the artifacts frame host.Text. Claude Code sends it as Authorization: Bearer plus the value, only when the frame host mode is activeArtifacts frame requests. Not set from project env before trust
CLAUDE_CODE_ATTRIBUTION_PROJECT
Undocumented: Only the program shows this item. It can change without notice.
Names the claude.ai Project that the usage reports of this session are tied to. At startup Claude Code shows a notice with the Project, and a bad value gives a warning.Text. A Project UUID or a claude_proj_ ID. Any other value is ignored with a warning. The attributionProject key of a settings file and an organization default are other sourcesAll sessions
CLAUDE_CODE_AUTH_FAIL_EXIT_MS
Undocumented: Only the program shows this item. It can change without notice.
Makes a remote child session exit when an OAuth 401 stays unrecovered for this long. The runner then restarts it with fresh credentials.A number of milliseconds, 600000 by default. Whole number, minimum 0. A value of 0 turns the exit offRemote child sessions
CLAUDE_CODE_CUSTOM_OAUTH_URL
Undocumented: Only the program shows this item. It can change without notice.
Replaces the OAuth base URL and endpoints with a custom host. Throws if the URL is not on the approved endpoint list.Text. Claude Code removes a trailing slash. Only fedstart style hosts pass the checkAll sessions, first-party auth
CLAUDE_CODE_DESIGN_OAUTH_CLIENT_ID
Undocumented: Only the program shows this item. It can change without notice.
Sets the OAuth client id for Claude Design login. A build without a registered client shows an error that asks for this variable.Text. A value starting with 00000000- counts as unsetClaude Design login
CLAUDE_CODE_DISABLE_AUTH_REFRESH_LOCK
Documented: An official docs page names this item.
Makes each process run gcpAuthRefresh or awsAuthRefresh itself without the cross-process lock.On or off. Code gates the auth refresh lock on its negationBedrock and Vertex with auth refresh
CLAUDE_CODE_DISABLE_LAUNCHER_SIGN_IN
Undocumented: Only the program shows this item. It can change without notice.
Turns off the sign-in that a host app, such as the desktop app, hands to Claude Code.On or off. Off by default. Since 2.1.307Host apps. The env of managed settings can set it
CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER
Undocumented: Only the program shows this item. It can change without notice.
Turns on the proxyAuthHelper setting so a helper command can mint proxy auth headers.On or off, off by default. Cache TTL comes from CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS, default 300000Proxy setups
CLAUDE_CODE_ENABLE_XAA
Undocumented: Only the program shows this item. It can change without notice.
Gated: Works only behind a flag or a server gate. Turns XAA on when set to 1
Turns on XAA for MCP OAuth and unlocks the xaaIdp setting.On or off, off by default. Without it, MCP OAuth with oauth.xaa fails with XAA is not enabled. 1 turns it on. See MCP AuthenticationMCP OAuth
CLAUDE_CODE_FEDERATION_CACHE_DIR
Undocumented: Only the program shows this item. It can change without notice.
Sets the directory for the workload identity federation token cache.Text. Default is a credentials/federation folder in the config dirFederated auth, eval harness copies it
CLAUDE_CODE_FORCE_WINDOWS_CREDMAN
Undocumented: Only the program shows this item. It can change without notice.
Gated: Works only behind a flag or a server gate. A feature flag or server gate decides by default. This variable overrides it
Forces the Windows Credential Manager path on when set to 1.Text. Else the cached a feature flag decidesWindows
CLAUDE_CODE_GATEWAY_TOKEN_FILE_DESCRIPTOR
Undocumented: Only the program shows this item. It can change without notice.
Reads the gateway token from this open file descriptor. Then it removes the var from the env.A number. Claude Code ignores it with CLAUDE_CODE_REMOTE or an IPC channelHosts that spawn Claude Code
CLAUDE_CODE_HOST_AUTH_ENV_VAR
Undocumented: Only the program shows this item. It can change without notice.
Names the env var that holds the credential a host app supplies. Its presence counts as host-managed auth.Text. Claude Code skips reserved names. It removes the variable from some child envsHost apps that embed Claude Code
CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS
Undocumented: Only the program shows this item. It can change without notice.
Passes a timeout to the request that asks the SDK host to refresh the auth token.A number of milliseconds. Used only when CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH is set. An invalid value means no timeoutSDK host, stream-json print mode
CLAUDE_CODE_HOST_CREDS_FILE
Undocumented: Only the program shows this item. It can change without notice.
Names a credentials file that a host app owns. Claude Code tests paths against it. It also adds it to a path list built with the sandbox rules.Text. Also turns on the gateway lineage check together with CLAUDE_CODE_HOST_GATEWAY_LINEAGE. Its name is kept from childrenHost apps with a gateway
CLAUDE_CODE_HOST_GATEWAY_LINEAGE
Undocumented: Only the program shows this item. It can change without notice.
Marks a session as gateway-managed by the host. It counts only when CLAUDE_CODE_HOST_CREDS_FILE is also set.On or off. Claude Code sets it to 1 for child processes when its lineage check passes. Claude Code removes it in other child envsHost apps with a gateway, set by Claude Code
CLAUDE_CODE_OAUTH_401_WAIT_MS
Undocumented: Only the program shows this item. It can change without notice.
Sets a wait in ms for OAuth 401 recovery. Where the wait is used was not traced.A number of milliseconds. Default 0, or a built-in value in a session with CLAUDE_CODE_REMOTE_SESSION_IDAll sessions
CLAUDE_CODE_OAUTH_CLIENT_ID
Undocumented: Only the program shows this item. It can change without notice.
Overrides the OAuth client id for login and for refresh-token login.Text. When set it also clears the registered plugin and project scope flagsAll sessions, OAuth
CLAUDE_CODE_OAUTH_REFRESH_TOKEN
Documented: An official docs page names this item.
Lets claude auth login exchange a refresh token with no browser. Needs CLAUDE_CODE_OAUTH_SCOPES.Text. Startup stops with an error when the scopes are missing. A used token cannot be reusedclaude auth login
CLAUDE_CODE_OAUTH_SCOPES
Documented: An official docs page names this item.
Gives the scopes that the refresh token was issued with. It also sets the scopes of CLAUDE_CODE_OAUTH_TOKEN.Text, scope by default. Docs mention only the refresh token useAll sessions, OAuth
CLAUDE_CODE_OAUTH_TOKEN
Documented: An official docs page names this item.
Gives an OAuth access token for claude.ai auth that wins over stored login.Text. Counts as an auth source. Claude Code drops it from shell child envsAll sessions, SDK and automation
CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR
Undocumented: Only the program shows this item. It can change without notice.
Counts as an OAuth token source like CLAUDE_CODE_OAUTH_TOKEN. The code shown only tests that it is set.Text. Remote sessions print set or unset for it in an error messageAll sessions, remote sessions
CLAUDE_CODE_ORGANIZATION_UUID
Undocumented: Only the program shows this item. It can change without notice.
Sets the organization UUID. Claude Code sends it as X-Organization-Uuid with a sk-ant-sid session key. It also uses it as the org ID before the OAuth profile lookup.Text. With CLAUDE_CODE_ACCOUNT_UUID and CLAUDE_CODE_USER_EMAIL it builds the oauthAccount. A self-hosted runner passes it to sessionsAll sessions, mostly cloud and runner sessions
CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS
Undocumented: Only the program shows this item. It can change without notice.
Sets the time-to-live of the proxy auth helper result. The helper itself needs CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER.A number of milliseconds, constant by default. Whole number in ms of 0 or more. Negative or unset gives an internal default constantAll sessions, when the proxy auth helper is on
CLAUDE_CODE_PROXY_AUTHENTICATE
Undocumented: Only the program shows this item. It can change without notice.
Claude Code sets it in the environment of the proxy auth helper command. It holds the challenge of the proxy. Claude Code sets it only when there is one.Text. Claude Code sets it for the helper. The helper itself needs CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPERProxy auth helper only. Also set for SELF_HOSTED_RUNNER_PROXY_AUTHORIZATION_COMMAND
CLAUDE_CODE_PROXY_HOST
Undocumented: Only the program shows this item. It can change without notice.
Claude Code sets it in the environment of the proxy auth helper command. It holds the host name of the proxy.Text. Claude Code sets it for the helper, when the proxy URL has a hostProxy auth helper only. Also set for SELF_HOSTED_RUNNER_PROXY_AUTHORIZATION_COMMAND
CLAUDE_CODE_PROXY_URL
Undocumented: Only the program shows this item. It can change without notice.
Claude Code sets it in the environment of the proxy auth helper command. It holds the URL of the proxy.Text. Claude Code sets it for the helper, when a proxy URL is knownProxy auth helper only. Also set for SELF_HOSTED_RUNNER_PROXY_AUTHORIZATION_COMMAND
CLAUDE_CODE_RATE_LIMIT_TIER
Undocumented: Only the program shows this item. It can change without notice.
Gives the rate limit tier for a token from CLAUDE_CODE_OAUTH_TOKEN.Text. Claude Code sets it from a background auth snapshot. Used with CLAUDE_CODE_SUBSCRIPTION_TYPESessions using an env OAuth token
CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH
Undocumented: Only the program shows this item. It can change without notice.
Tells Claude Code that the SDK host can refresh host auth tokens. Claude Code then asks the host for a new token when needed.Claude Code sets it to 1 in the SDK child env when the host supports it. The wait uses CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MSSDK and print mode. Claude Code sets it
CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH
Undocumented: Only the program shows this item. It can change without notice.
Tells Claude Code that the SDK host can refresh the OAuth token. Claude Code then requests a refresh from the host.Claude Code sets it to 1 in the SDK child env when the host supports it. It takes effect only for some entrypointsSDK and print mode. Claude Code sets it
CLAUDE_CODE_SDK_HAS_SESSIONS_OAUTH_REFRESH
Undocumented: Only the program shows this item. It can change without notice.
Tells Claude Code that the SDK host can hand it a second token for the cloud sessions API when asked. Added in 2.1.311.On or off. It takes effect only with CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH and a supported entrypointSDK and print mode. Set by the SDK host
CLAUDE_CODE_SESSIONS_OAUTH_TOKEN
Undocumented: Only the program shows this item. It can change without notice.
Holds a second token that authorizes the cloud sessions API. The host can set it while the process runs, with an update_environment_variables message. Added in 2.1.311.Text. The message accepts only CLAUDE_CODE_SESSION_ACCESS_TOKEN, CLAUDE_CODE_OAUTH_TOKEN, and this name. Claude Code drops it from the variables it copies to a new cloud session. A value that fails its check is refusedSDK and print mode. Set by a host
CLAUDE_CODE_SESSION_ACCESS_TOKEN
Documented: An official docs page names this item.
Holds the session access token for remote sessions. Claude Code sends it as Authorization: Bearer, or as a cookie when it starts with sk-ant-sid.Text. Falls back to the token fileRemote and ingress sessions. Claude Code sets it on refresh
CLAUDE_CODE_SUBSCRIPTION_TYPE
Undocumented: Only the program shows this item. It can change without notice.
Gives the subscription type for a token supplied through CLAUDE_CODE_OAUTH_TOKEN. Claude Code also sets it from a background auth snapshot.Text. Claude Code uses it with CLAUDE_CODE_RATE_LIMIT_TIEROAuth token auth and background sessions
CLAUDE_CODE_USER_EMAIL
Undocumented: Only the program shows this item. It can change without notice.
Supplies the account email when a host passes the account by env. Claude Code also uses it as user.email in telemetry and in the user context.Text. Account use needs CLAUDE_CODE_ACCOUNT_UUID and CLAUDE_CODE_ORGANIZATION_UUID tooSDK hosts and remote runs
CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR
Undocumented: Only the program shows this item. It can change without notice.
Names a file descriptor that holds the WebSocket session token. Claude Code reads the token at startup.Text. Claude Code reads it next to the API key and gateway descriptor readsRemote and SDK URL sessions
CLAUDE_LOCAL_OAUTH_API_BASE
Undocumented: Only the program shows this item. It can change without notice.
Sets the API base URL in the local OAuth config.Text, http by default. Claude Code removes a trailing slashLocal OAuth config
CLAUDE_LOCAL_OAUTH_APPS_BASE
Undocumented: Only the program shows this item. It can change without notice.
Sets the claude.ai origin and authorize URL in the local OAuth config.Text, http by default. Claude Code removes a trailing slashLocal OAuth config
CLAUDE_LOCAL_OAUTH_CONSOLE_BASE
Undocumented: Only the program shows this item. It can change without notice.
Sets the console authorize URL in the local OAuth config.Text, http by default. Claude Code removes a trailing slashLocal OAuth config
CLAUDE_SECURESTORAGE_CONFIG_DIR
Undocumented: Only the program shows this item. It can change without notice.
Overrides the config directory that names the secure-storage credentials entry.A path-
CLAUDE_SESSION_INGRESS_TOKEN_FILE
Documented: An official docs page names this item.
Sets the path of the file that holds the session ingress token. A set value also makes the entrypoint remote.A path-
CLAUDE_TRUSTED_DEVICE_TOKEN
Undocumented: Only the program shows this item. It can change without notice.
Supplies the trusted device token. It wins over the stored token and stops trusted-device enrollment.Text (a secret)-
DISABLE_LOGIN_COMMAND
Documented: An official docs page names this item.
Hides the /login command.On or off-
DISABLE_LOGOUT_COMMAND
Documented: An official docs page names this item.
Hides the /logout command.On or off-
GH_ENTERPRISE_TOKEN
Documented: An official docs page names this item.
Gives the token for a GitHub Enterprise host. Claude Code uses it when GH_HOST names that host. Claude Code sets it to an empty value for gh auth token and removes it for the gh repo check. The cloud gh shim leaves it alone and runs the real gh.Text. The program exempts it from the name match of CLAUDE_CODE_SUBPROCESS_ENV_SCRUB. A run with the scrub on still showed it in a Bash child. Hooks and stdio MCP servers were not runGitHub features. Not set from project env before trust
GH_TOKEN
Documented: An official docs page names this item.
Gives the token for github.com. Claude Code uses it first for GitHub API calls. Claude Code sets it to an empty value when it runs gh auth token to read your stored gh login. Claude Code removes it for the gh repo check when GH_HOST names another host. In cloud sessions a gh shim replaces it with the text proxy-injected unless you set a real token.Text. The program exempts it from the name match of CLAUDE_CODE_SUBPROCESS_ENV_SCRUB. A run with the scrub on still showed it in a Bash child. Hooks and stdio MCP servers were not runGitHub features. Not set from project env before trust
GITHUB_ENTERPRISE_TOKEN
Documented: An official docs page names this item.
Second name for the GitHub Enterprise token, after GH_ENTERPRISE_TOKEN. Handled the same way.Text. The program exempts it from the name match of CLAUDE_CODE_SUBPROCESS_ENV_SCRUB. A run with the scrub on still showed it in a Bash child. Hooks and stdio MCP servers were not runGitHub features. Not set from project env before trust
GITHUB_TOKEN
Documented: An official docs page names this item.
Second name for the github.com token, after GH_TOKEN. Handled the same way.Text. The program exempts it from the name match of CLAUDE_CODE_SUBPROCESS_ENV_SCRUB. A run with the scrub on still showed it in a Bash child. Hooks and stdio MCP servers were not runGitHub features. Not set from project env before trust
MCP_CLIENT_SECRET
Documented: An official docs page names this item.
Gives the OAuth client secret for MCP servers with pre-set credentials, without a prompt.Text (a secret). Skips the prompt of --client-secret-
MCP_OAUTH_CALLBACK_PORT
Documented: An official docs page names this item.
Fixes the port of the MCP OAuth redirect callback.A number. Same as --callback-port-
MCP_OAUTH_CLIENT_METADATA_URL
Undocumented: Only the program shows this item. It can change without notice.
Overrides the OAuth client metadata document URL that MCP OAuth uses.A URL-
MCP_XAA_IDP_CLIENT_SECRET
Undocumented: Only the program shows this item. It can change without notice.
Gated: Works only behind a flag or a server gate. Needs CLAUDE_CODE_ENABLE_XAA
Gives the identity provider client secret for the MCP cross-app access (XAA) setup command.Text (a secret). Read by claude mcp xaa setup --client-secret-
USE_LOCAL_OAUTH
Undocumented: Only the program shows this item. It can change without notice.
Points OAuth and bridge URLs at a local server. It switches the bridge to ws://localhost:8765 and trusts localhost hosts.On or off. A dev OAuth and bridge setup uses it. Do not use it for normal workAll sessions, development only
USE_STAGING_OAUTH
Undocumented: Only the program shows this item. It can change without notice.
Points OAuth and bridge URLs at staging. The bridge uses wss://bridge-staging.claudeusercontent.com.On or off. Claude Code sets it to 1 for remote sessions when the api_base_url contains stagingAll sessions, set by Claude Code for staging cloud

How It Works​

When several credentials exist, Claude Code uses the first one in its own order. The official docs list the order on the Authentication page. ANTHROPIC_API_KEY takes precedence over a profile sign-in. Claude Code sets some variables on this page for remote sessions and refreshes them. Do not set those by hand.

Source: the program (variable names found in the 2.1.312 binary) and the Environment Variables page of the official docs.