Neon CLI commands — auth
Use the Neon CLI to manage Neon directly from the terminal
Before you begin
Before running the
auth command, ensure that you have installed the Neon CLI.
Authenticates the user or caller to Neon.
The command launches a browser window where you can authorize the Neon CLI to access your Neon account. After granting permissions to the Neon CLI, your credentials are saved locally to a configuration file named
credentials.json, enabling you manage your account's projects from the command line.
An alternative to authenticating using
neon auth is to provide an API key when running a CLI command. You can do this using the global
--api-key option or by setting the
NEON_API_KEY variable. See Global options for instructions.
The authentication flow for the Neon CLI follows this order:
- If the
--api-keyoption is provided, it is used for authentication.
- If the
--api-keyoption is not provided, the
NEON_API_KEYenvironment variable setting is used.
- If there is no
NEON_API_KEYenvironment variable setting, the CLI looks for the
credentials.jsonfile created by the
- If the credentials file is not found, the Neon CLI initiates the
neonctl authweb authentication process.
Only global options apply.