## login

Connect the CLI to your Stripe account with a browser-based login flow. The CLI displays a pairing code and opens the Stripe Dashboard, where you confirm the code and configure the CLI's access to accounts, sandboxes, and live mode.

After approval, the CLI stores your credentials in your operating system's secure credential store (when available) and refreshes the session automatically.

Use [stripe login list](https://docs.stripe.com/cli/login/list.md) to inspect authorized contexts and [stripe switch context](https://docs.stripe.com/cli/switch/context.md) to select another context. To change permissions or add accounts or sandboxes, use [stripe reauth](https://docs.stripe.com/cli/reauth.md). To revoke the session and clear its local credentials, use [stripe logout](https://docs.stripe.com/cli/logout.md).

If you need to authenticate with an API key instead, use `stripe login --interactive` or one of the other [API-key options](https://docs.stripe.com/cli/api_keys.md).

> If you're already authenticated, `stripe login` keeps your current session. Use `stripe login --new-session` to revoke the current authentication and log in to a new session.

**Command:** `stripe login`

### Flags

- `-i, --interactive`
  Use interactive configuration mode if you cannot open a browser and would like to manually provide an API key.

- `--non-interactive`
  Print the browser URL, verification code, and next command as JSON, then exit. This behavior activates automatically when standard input isn't a terminal. Run the returned `next_step` command immediately after you approve access in the browser.

- `--complete=<poll-url>`
  Poll the URL provided by the `next_step` output from `stripe login --non-interactive` until you approve access, then save the credentials.

- `--new-session`
  Revoke the current authentication and log in to a new session.

### Examples

**Basic login**

```sh
stripe login
```

**Start login in a non-interactive environment**

```sh
stripe login --non-interactive
```

```
{
  "browser_url": "https://dashboard.stripe.com/stripecli/confirm?...",
  "verification_code": "ABCD-EFGH",
  "next_step": "stripe login --complete 'https://...'"
}
```

**Log in using interactive mode**

```sh
stripe login --interactive
```

```
Enter your API key:
Your API key is: sk_******************************p7dc
...
```
