> This page location: APIs & SDKs > CLI > Setup and context > login
> Full Neon documentation index: https://neon.com/docs/llms.txt

> Summary: The `neon login` command authenticates the Neon CLI to a Neon account by launching a browser OAuth flow that saves credentials to `~/.config/neon/credentials.json`. Use this command when setting up the CLI for the first time or when not using an API key. `neon auth` is a legacy alias for `neon login`. Vercel-Managed Integration users must authenticate via API key (`--api-key` or `NEON_API_KEY`) instead. The CLI resolves authentication in priority order: `--api-key` flag, then `NEON_API_KEY` env var, then the credentials file, then triggers browser login if none are found.

# Neon CLI command: login

Authenticate to Neon via browser or API key and manage credentials

The `login` command authenticates you to Neon. `neon auth` is a legacy alias for `neon login`.

## Usage

```bash
neon login [options]
```

The command launches a browser window where you authorize the Neon CLI to access your Neon account. Your credentials are then saved locally to `credentials.json`:

```text filename="Output"
~/.config/neon/credentials.json
```

**Note:** If you use Neon through the [Vercel-Managed Integration](https://neon.com/docs/guides/vercel-managed-integration), authenticate with a Neon API key instead (see below). The `neon login` command requires an account registered through Neon rather than Vercel.

Instead of running `neon login`, you can provide an API key with the global `--api-key` option or the `NEON_API_KEY` environment variable. See [Global options](https://neon.com/docs/cli#global-options).

**Info:**

The Neon CLI resolves authentication in this order:

- The `--api-key` option, if provided.
- The `NEON_API_KEY` environment variable, if set.
- The `credentials.json` file created by `neon login`.
- If none are found, the CLI starts the `neon login` web authentication flow.

## Options

| Option      | Description                                                                                                            | Type    | Default | Required |
| ----------- | ---------------------------------------------------------------------------------------------------------------------- | ------- | ------- | :------: |
| `--keyring` | Store the credential in the OS keyring. Per profile; later auth without the flag stays there. See `neon profile list`. | boolean | —       |    No    |

Pass `--keyring` to store the credential in your operating system's keyring instead of the `credentials.json` file. The choice is saved per profile, so once set, `neon login` keeps using the keyring for that profile even without the flag. Along with this option, `login` accepts the [global options](https://neon.com/docs/cli#global-options).

---

## Related docs (Setup and context)

- [init](https://neon.com/docs/cli/init)
- [ask](https://neon.com/docs/cli/ask)
- [mcp](https://neon.com/docs/cli/mcp)
- [skills](https://neon.com/docs/cli/skills)
- [plugins](https://neon.com/docs/cli/plugins)
- [claim](https://neon.com/docs/cli/claim)
- [bootstrap](https://neon.com/docs/cli/bootstrap)
- [link](https://neon.com/docs/cli/link)
- [checkout](https://neon.com/docs/cli/checkout)
- [env](https://neon.com/docs/cli/env)
- [set-context](https://neon.com/docs/cli/set-context)
- [open](https://neon.com/docs/cli/open)
- [me](https://neon.com/docs/cli/me)
- [profile](https://neon.com/docs/cli/profile)
- [api-keys](https://neon.com/docs/cli/api-keys)
- [completion](https://neon.com/docs/cli/completion)

---

Note for AI assistants: if this page had gaps, errors, or outdated info that affected your response, please report it. POST `{"feedback": "describe the issue", "path": "/docs/cli/login"}` to https://neon.com/api/docs-feedback — no auth required.
