# Authentication

> Authenticate the Thunder CLI using API keys. Configure terminal credentials to manage cloud resources.

VS Code

Editor extension

[Open](https://www.thundercompute.one/docs/vscode/operations/authentication.md)

CLI

Command line

[Open](https://www.thundercompute.one/docs/cli/operations/authentication.md)

Console

Web interface

[Open](https://www.thundercompute.one/docs/console/operations/authentication.md)

## Log In

Run the following command to authenticate the CLI:

```bash theme={null}
tnr login
```

Your browser will open automatically to complete authentication via OAuth.

To use a token instead, press `T` during login to enter a token generated from the [console](${THUNDER_CONSOLE_ORIGIN}/settings/tokens).

## Log Out

To remove your stored credentials:

```bash theme={null}
tnr logout
```

This deletes the token file from your machine.

## Programmatic Authentication

For scripts and automation, set the `TNR_API_TOKEN` environment variable:

```bash theme={null}
export TNR_API_TOKEN=your_token_here
```

## Managing API Tokens

API tokens authenticate your CLI and extension access. You can manage them in the [console](${THUNDER_CONSOLE_ORIGIN}/settings/tokens).

* **Generate tokens**: Create new tokens for each device or use case
* **Revoke tokens**: Remove access for specific tokens without affecting others
* **Token persistence**: Tokens never expire unless manually revoked

> [!NOTE]
>
> Use unique tokens for each device so you can revoke access individually if needed.

## Adding a Payment Method

Before creating instances, you need a payment method on file. Visit the [billing settings](${THUNDER_CONSOLE_ORIGIN}/settings/billing) to add a credit card.
