doctl auth
Generated on 19 Nov 2026
from doctl version
v2.7.0
Usage
doctl auth [flags]Description
The doctl auth commands allow you to authenticate doctl for use with your DigitalOcean account, either by signing in through your browser with OAuth or with tokens that you generate in the control panel at https://cloud.digitalocean.com/account/api/tokens.
The quickest way to get started is doctl auth login, which uses the OAuth 2.1 authorization code flow with PKCE. It opens your browser so you can approve access, then saves the access token to the default authentication context. Tokens issued this way are short-lived; doctl stores a refresh token and renews the access token automatically, so you do not have to return to the control panel when it expires. Use --scopes to request permissions up front, such as --scopes "read write", or omit it to choose them on the authorization screen.
If you prefer a personal access token instead, call doctl auth init and supply the token when prompted. This creates an authentication context named default.
To use multiple DigitalOcean accounts, including team accounts, create a named context with doctl auth login --context <name> or doctl auth init --context <name>. The credentials are saved under the name you provide. To change which context later commands use, run doctl auth switch --context <name>.
To remove an account from the configuration file, run doctl auth remove --context <name>. This deletes the credentials saved under the name you provide.
Flags
| Option | Description |
|---|---|
--help, -h |
Help for this command |
Related Commands
| Command | Description |
|---|---|
| doctl | doctl is a command line interface (CLI) for the DigitalOcean API. |
| doctl auth init | Initialize doctl to use a specific account |
| doctl auth list | List available authentication contexts |
| doctl auth login | Sign in to DigitalOcean via OAuth 2.1 in your browser |
| doctl auth remove | Remove authentication contexts |
| doctl auth switch | Switch between authentication contexts |
| doctl auth token | Display current authentication context API token |
Global Flags
| Option | Description |
|---|---|
--access-token, -t |
API V2 access token |
--api-url, -u |
Override default API endpoint |
--config, -c |
Specify a custom config file Default: |
--context |
Specify a custom authentication context name |
--http-retry-max |
Set maximum number of retries for requests that fail with a 429 or 500-level error
Default: 5 |
--http-retry-wait-max |
Set the minimum number of seconds to wait before retrying a failed request
Default: 30 |
--http-retry-wait-min |
Set the maximum number of seconds to wait before retrying a failed request
Default: 1 |
--interactive |
Enable interactive behavior. Defaults to true if the terminal supports it (default false)
Default: false |
--output, -o |
Desired output format [text|json] Default: text |
--show |
Reveal masked values, such as secrets, instead of hiding them. Values are unmasked automatically in CI
Default: false |
--trace |
Show a log of network activity while performing a command Default: false |
--verbose, -v |
Enable verbose output Default: false |