anaconda-auth is a client library and CLI for authenticating with Anaconda APIs and securely storing API keys. This package provides centralized authentication for the Anaconda ecosystem.
Installation
Basic usage
Log in to Anaconda
This command opens your browser to authenticate your Anaconda account. Once completed, an API key is stored securely in your/.anaconda/keyring.
Check authentication status
This command displays information about the currently signed-in user.Display your API key
This command prints the API key for the signed-in user (useful for non-interactive environments).Logout
This command removes the stored API key from your keyring.Configuration
Configuration comes from multiple sources. When the same setting appears in more than one place, the highest-priority source wins:ANACONDA_AUTH_*environment variables (highest priority).envfile in the current working directory- Site settings (
[sites.<NAME>]) in/.anaconda/config.toml - Global plugin settings (
[plugin.auth]) in/.anaconda/config.toml - Conda context (proxy servers, SSL settings) from
.condarc
Site configuration
Useanaconda sites add to register the Anaconda Platform domain you want to authenticate against:
[sites] entry to .anaconda/config.toml and sets it as the default site. To verify, run anaconda sites list. For the full list of site management commands, see sites.
If you are using anaconda.com, no site configuration is needed.
[sites.<name>] section. When a parameter is not set on the site, the value from [plugin.auth] is used as a fallback. For more information on site configuration, see the sites command reference.
Global options
The[plugin.auth] section of /.anaconda/config.toml sets defaults that apply across all sites.
Parameter
Environment Variable
Description
Default
domainANACONDA_AUTH_DOMAINDefault domain when no site is configured. Use
anaconda sites add to specify site.anaconda.comssl_verifyANACONDA_AUTH_SSL_VERIFYEnable SSL verification for all requests
Trueapi_keyANACONDA_AUTH_API_KEYAPI key (overrides keyring lookup)
Nonepreferred_token_storageANACONDA_AUTH_PREFERRED_TOKEN_STORAGEWhere to store the login token.
anaconda-keyring uses a file-based keyring at /.anaconda/keyring. system uses the OS keyring if available, falling back to anaconda-keyring.anaconda-keyringextra_headersANACONDA_AUTH_EXTRA_HEADERSExtra request headers in JSON format
Noneuse_device_flowANACONDA_AUTH_USE_DEVICE_FLOWUse the OAuth device code flow for login instead of a browser redirect
Falseuse_unified_repo_api_keyANACONDA_AUTH_USE_UNIFIED_REPO_API_KEYUse a unified API key for conda repository access instead of a separate repo token
Falsedisable_conda_auto_configANACONDA_AUTH_DISABLE_CONDA_AUTO_CONFIGDisable automatic configuration of conda’s
channel_settings on loginFalseExample configuration
my-platform site but remains enabled as the default for any other site.
Non-interactive usage
API keys issued byanaconda auth login are valid for one year. On systems without interactive browser access, there are several ways to authenticate:
- Environment variable
- Copy the keyring file
- Device flow
- On a system with browser access, run
anaconda auth api-keyto get your API key. - On the non-interactive system, set the
ANACONDA_AUTH_API_KEYenvironment variable (or add it to a.envfile in your working directory).