---
title: "auth - Xata"
description: "Commands for authenticating with Xata"
source: "https://xata.io/docs/cli/auth"
---

Skip to main content

The `auth` command helps you manage authentication and account profiles for the Xata CLI.

## ​Subcommands

### ​login

Log in to a Xata account.

```
xata auth login [--profile <name>] [-f|--force] [--issuer <url>] [--api-url <url>] [--client-id <id>] [--client-secret <secret>] [-h|--help]
```

​

\--profile

string

Profile to log in to (default: `default`)

​

-f, --force

boolean

Force login even if already logged in

​

-h, --help

boolean

Print help information and exit

#### ​Custom environment flags

For Enterprise customers we allow connecting the CLI to a custom deployment in their cloud. Pass any of the flags below to log in against a non-production environment; if omitted, the CLI uses the default production values.

​

\--issuer

string

Issuer URL for the custom environment

​

\--api-url

string

API base URL for the custom environment

​

\--client-id

string

Client ID for the custom environment (defaults to `cli`)

​

\--client-secret

string

Client secret for the custom environment

### ​list

List all available Xata account profiles.

```
xata auth list [--json] [-h|--help]
```

​

\--json

boolean

Output the list of profiles in JSON format

​

-h, --help

boolean

Print help information and exit

### ​logout

Log out of the current account.

```
xata auth logout [--profile <name>] [--yes] [-h|--help]
```

​

\--profile

string

Profile to log out of (default: `default`)

​

\--yes

boolean

Do not ask for confirmation, assume yes

​

-h, --help

boolean

Print help information and exit

### ​status

Display active account and authentication state.

```
xata auth status [--profile <name>] [-h|--help]
```

​

\--profile

string

Profile to log in to (default: `default`)

​

-h, --help

boolean

Print help information and exit

### ​switch

Switch to a different Xata account profile.

```
xata auth switch <profile>
xata auth switch --help
```

​

profile

string

required

The profile to switch to

​

-h, --help

boolean

Print help information and exit

### ​access-token

Print the current access token.

```
xata auth access-token [--profile <name>] [-h|--help]
```

​

\--profile

string

Profile to log in to (default: `default`)

​

-h, --help

boolean

Print help information and exit

### ​refresh-token

Print the current refresh token.

```
xata auth refresh-token [--profile <name>] [-h|--help]
```

​

\--profile

string

Profile to log in to (default: `default`)

​

-h, --help

boolean

Print help information and exit

## ​Global Flags

​

-h, --help

boolean

Print help information and exit

Was this page helpful?

[branch](/docs/cli/branch)

[Next](/docs/cli/branch)
