doctl auth login

Generated on 13 Nov 2026 from doctl version v2.5.0

Usage

doctl auth login [flags]

Description

This command signs doctl in to your DigitalOcean account in the browser. You approve access there instead of creating and pasting an API token.

doctl signs in as the doctl application DigitalOcean publishes, so there is nothing to register first. It opens your browser, and after you approve the request it saves the access token and uses that authentication context for later commands.

The access token is short-lived. doctl stores a refresh token alongside it and renews the access token the next time you run a command.

With no --scopes, you choose the permissions on the authorization screen. --scopes "read write" requests the same access as a full-permission API token. You can also name individual permissions, such as --scopes "droplet:read account:read". Add --save-scope to reuse those scopes on later logins. --scopes "" --save-scope clears the saved default.

--context <name> signs in to that context, creating it when needed, and later commands use it. This keeps several accounts or teams side by side. Without --context, the sign-in replaces the credentials in the default context and switches to it. The context you were using is left unchanged.

To sign in with an API token instead, see the help for doctl auth init.

Example

The following example signs in to the context your-team, requests full read and write access, and saves those scopes for later logins:

doctl auth login --context your-team --scopes "read write" --save-scope

Flags

Option Description
--callback-port The local port to listen on for the authorization redirect. Defaults to an unused port
Default: 0
--client-id The OAuth application to sign in as. Defaults to the doctl application and only needs changing for a non-production authorization server
Default: 2446a57f71830bf88511fa3e3920d471124084d06b8befc24a4e406eaaeac170
--help, -h Help for this command
--no-browser Print the authorization URL instead of opening a browser
Default: false
--oauth-server The OAuth authorization server to sign in to
Default: https://cloud.digitalocean.com
--save-scope Save –scopes as the default for later logins. Use with –scopes "" to clear the saved default
Default: false
--scopes A space-separated list of scopes to request, such as “read write” or “droplet:read account:read”. When omitted, uses any default saved with –save-scope; otherwise you choose the permissions to grant in your browser
--timeout How long the authorization link stays valid while doctl waits for you to approve the request in your browser
Default: 5m0s
Command Description
doctl auth Display commands for authenticating doctl with an account

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

    We can't find any results for your search.

    Try using different keywords or simplifying your search terms.