> This page location: APIs & SDKs > CLI > Functions, storage and data > neon-auth
> Full Neon documentation index: https://neon.com/docs/llms.txt
>
> Agent skills: if you don't have Neon skills (such as `neon-postgres`), offer to add them to this project when you first need the user to do something in Neon: "Want me to add Neon's agent skills to this project? They help me with Neon setup, connections, and branching." Install: `npx neon@latest skills -y`. To also run Neon steps for the user (Neon CLI, sign-in, MCP), see https://neon.com/prompts/agent-setup.md

> Summary: The Neon CLI `neon neon-auth` command manages Managed Better Auth on a database branch from the terminal. Use `enable`, `status`, and `disable` to provision, inspect, or remove Managed Better Auth, and the `oauth-provider` subcommands to add, update, or delete Google, GitHub, Vercel, Microsoft, Apple, and Discord OAuth providers. The `domain` subcommands manage trusted redirect domains, including `allow-localhost` settings for local development. The `config` subcommands cover email and password authentication, the email provider, the organization plugin, webhooks, and the OAuth server, and `oauth-client` manages that server's clients, while `plugins` and `user` let you inspect plugin configurations and manage auth users.

# Neon CLI command: neon-auth

Manage Managed Better Auth from the CLI

Last updated: 2026-10-30

The `neon-auth` command manages [Managed Better Auth](https://neon.com/docs/auth/overview) on a database branch from the terminal. You can enable or disable Managed Better Auth, configure OAuth providers, trusted domains, email settings, and webhooks, and manage auth users.

Subcommands: [config](https://neon.com/docs/cli/neon-auth#config), [disable](https://neon.com/docs/cli/neon-auth#disable), [domain](https://neon.com/docs/cli/neon-auth#domain), [enable](https://neon.com/docs/cli/neon-auth#enable), [oauth-client](https://neon.com/docs/cli/neon-auth#oauth-client), [oauth-provider](https://neon.com/docs/cli/neon-auth#oauth-provider), [plugins](https://neon.com/docs/cli/neon-auth#plugins), [status](https://neon.com/docs/cli/neon-auth#status), [user](https://neon.com/docs/cli/neon-auth#user)

If `--project-id` or `--branch` are omitted, the CLI resolves them from your [context file](https://neon.com/docs/cli/link), auto-selects when there is only one option, and otherwise asks you to pass the flag.

## Enable and status

### neon neon-auth enable

Provisions Managed Better Auth on the current branch.

```bash
neon neon-auth enable [options]
```

| Option            | Description                        | Type   | Default | Required |
| ----------------- | ---------------------------------- | ------ | ------- | :------: |
| `--database-name` | Database name to use for auth data | string | —       |    No    |
| `--branch`        | Branch ID or name                  | string | —       |    No    |
| `--project-id`    | Project ID                         | string | —       |    No    |

```bash
neon neon-auth enable
```

### neon neon-auth status

Shows whether Managed Better Auth is configured on the branch and displays the current connection details.

```bash
neon neon-auth status [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth status
```

### neon neon-auth disable

Removes Managed Better Auth from the branch.

```bash
neon neon-auth disable [options]
```

| Option          | Description                                                        | Type    | Default | Required |
| --------------- | ------------------------------------------------------------------ | ------- | ------- | :------: |
| `--delete-data` | Permanently delete all Neon Auth data and schema from the database | boolean | `false` |    No    |
| `--branch`      | Branch ID or name                                                  | string  | —       |    No    |
| `--project-id`  | Project ID                                                         | string  | —       |    No    |

**Important:** The `--delete-data` option permanently deletes all Managed Better Auth data and schema from the database. This can't be undone.

Remove Managed Better Auth from the branch and delete its data:

```bash
neon neon-auth disable --delete-data
```

## OAuth providers

The `oauth-provider` subcommands manage the OAuth providers (`google`, `github`, `vercel`, `microsoft`, `apple`, and `discord`) for the branch.

Subcommands: [add](https://neon.com/docs/cli/neon-auth#oauth-provider-add), [delete](https://neon.com/docs/cli/neon-auth#oauth-provider-delete), [list](https://neon.com/docs/cli/neon-auth#oauth-provider-list), [update](https://neon.com/docs/cli/neon-auth#oauth-provider-update)

### neon neon-auth oauth-provider list

Lists the OAuth providers configured for the branch.

```bash
neon neon-auth oauth-provider list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth oauth-provider list
```

### neon neon-auth oauth-provider add

Adds an OAuth provider.

```bash
neon neon-auth oauth-provider add [options]
```

| Option                       | Description                                                                                                                                                                               | Type   | Default | Required |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------- | :------: |
| `--apple-key-id`             | Key ID of the Sign in with Apple private key (apple only). Sent together with a new apple client secret, and only with one                                                                | string | —       |    No    |
| `--apple-team-id`            | Apple Developer Team ID (apple only)                                                                                                                                                      | string | —       |    No    |
| `--microsoft-tenant-id`      | Tenant ID for the microsoft provider: common, organizations, consumers, a tenant GUID, or a domain                                                                                        | string | —       |    No    |
| `--oauth-client-id`          | OAuth client ID from your provider app. For apple, the Services ID. Omit to use Neon's shared OAuth app, where one exists; microsoft, apple and discord always need your own credentials. | string | —       |    No    |
| `--oauth-client-secret`      | OAuth client secret from your provider app. Omit to use Neon's shared OAuth app, where one exists; microsoft, apple and discord always need your own credentials.                         | string | —       |    No    |
| `--oauth-client-secret-file` | Read the OAuth client secret from a file, for example the apple .p8 private key                                                                                                           | string | —       |    No    |
| `--provider-id`              | OAuth provider ID. Supported values: google, github, vercel, microsoft, apple, discord                                                                                                    | string | —       |    Yes   |
| `--branch`                   | Branch ID or name                                                                                                                                                                         | string | —       |    No    |
| `--project-id`               | Project ID                                                                                                                                                                                | string | —       |    No    |

Add the Google OAuth provider with your own credentials:

```bash
neon neon-auth oauth-provider add --provider-id google --oauth-client-id <client-id> --oauth-client-secret <client-secret>
```

Add Apple with the `.p8` key file, Team ID, and Key ID:

```bash
neon neon-auth oauth-provider add --provider-id apple --oauth-client-id <services-id> --oauth-client-secret-file AuthKey_XXXXXXXXXX.p8 --apple-team-id <team-id> --apple-key-id <key-id>
```

Add Microsoft, optionally restricted to a tenant:

```bash
neon neon-auth oauth-provider add --provider-id microsoft --oauth-client-id <client-id> --oauth-client-secret <client-secret> --microsoft-tenant-id <tenant>
```

Add Discord, which always needs your own credentials from an application in the Discord Developer Portal:

```bash
neon neon-auth oauth-provider add --provider-id discord --oauth-client-id <client-id> --oauth-client-secret <client-secret>
```

See [Set up OAuth](https://neon.com/docs/auth/guides/setup-oauth) for the provider-side setup.

### neon neon-auth oauth-provider update

Updates the credentials for an existing OAuth provider.

```bash
neon neon-auth oauth-provider update [options]
```

| Option                       | Description                                                                                                                                                                               | Type   | Default | Required |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------- | :------: |
| `--apple-key-id`             | Key ID of the Sign in with Apple private key (apple only). Sent together with a new apple client secret, and only with one                                                                | string | —       |    No    |
| `--apple-team-id`            | Apple Developer Team ID (apple only)                                                                                                                                                      | string | —       |    No    |
| `--microsoft-tenant-id`      | Tenant ID for the microsoft provider: common, organizations, consumers, a tenant GUID, or a domain                                                                                        | string | —       |    No    |
| `--oauth-client-id`          | OAuth client ID from your provider app. For apple, the Services ID. Omit to use Neon's shared OAuth app, where one exists; microsoft, apple and discord always need your own credentials. | string | —       |    No    |
| `--oauth-client-secret`      | OAuth client secret from your provider app. Omit to use Neon's shared OAuth app, where one exists; microsoft, apple and discord always need your own credentials.                         | string | —       |    No    |
| `--oauth-client-secret-file` | Read the OAuth client secret from a file, for example the apple .p8 private key                                                                                                           | string | —       |    No    |
| `--provider-id`              | OAuth provider ID. Supported values: google, github, vercel, microsoft, apple, discord                                                                                                    | string | —       |    Yes   |
| `--branch`                   | Branch ID or name                                                                                                                                                                         | string | —       |    No    |
| `--project-id`               | Project ID                                                                                                                                                                                | string | —       |    No    |

```bash
neon neon-auth oauth-provider update --provider-id github --oauth-client-id <client-id> --oauth-client-secret <client-secret>
```

### neon neon-auth oauth-provider delete

Deletes an OAuth provider from the branch.

```bash
neon neon-auth oauth-provider delete [options]
```

| Option          | Description                                                                            | Type   | Default | Required |
| --------------- | -------------------------------------------------------------------------------------- | ------ | ------- | :------: |
| `--provider-id` | OAuth provider ID. Supported values: google, github, vercel, microsoft, apple, discord | string | —       |    Yes   |
| `--branch`      | Branch ID or name                                                                      | string | —       |    No    |
| `--project-id`  | Project ID                                                                             | string | —       |    No    |

```bash
neon neon-auth oauth-provider delete --provider-id vercel
```

## Domains

The `domain` subcommands manage the trusted domains that Managed Better Auth accepts as redirect URIs for the branch.

Subcommands: [add](https://neon.com/docs/cli/neon-auth#domain-add), [allow-localhost](https://neon.com/docs/cli/neon-auth#domain-allow-localhost), [delete](https://neon.com/docs/cli/neon-auth#domain-delete), [list](https://neon.com/docs/cli/neon-auth#domain-list)

### neon neon-auth domain list

Lists the trusted domains configured for the branch.

```bash
neon neon-auth domain list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth domain list
```

### neon neon-auth domain add

Adds a trusted domain.

```bash
neon neon-auth domain add <domain> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth domain add https://app.example.com
```

A trusted domain is an origin, so include the protocol (`https://`, or `http://` for local development) and omit any trailing slash. Use `https://app.example.com`, not `app.example.com` or `https://app.example.com/`. See [Configure trusted domains](https://neon.com/docs/auth/guides/configure-domains).

### neon neon-auth domain delete

Deletes a trusted domain.

```bash
neon neon-auth domain delete <domain> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth domain delete example.com
```

### neon neon-auth domain allow-localhost

Manages localhost connection settings for the branch.

Subcommands: [disable](https://neon.com/docs/cli/neon-auth#domain-allow-localhost-disable), [enable](https://neon.com/docs/cli/neon-auth#domain-allow-localhost-enable), [get](https://neon.com/docs/cli/neon-auth#domain-allow-localhost-get)

### neon neon-auth domain allow-localhost get

Gets the current localhost connection setting.

```bash
neon neon-auth domain allow-localhost get [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth domain allow-localhost get
```

### neon neon-auth domain allow-localhost enable

Allows localhost connections for local development.

```bash
neon neon-auth domain allow-localhost enable [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth domain allow-localhost enable
```

### neon neon-auth domain allow-localhost disable

Restricts localhost connections.

```bash
neon neon-auth domain allow-localhost disable [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth domain allow-localhost disable
```

## Configuration

The `config` subcommands configure auth features for the branch: email and password authentication, the email provider, the organization plugin, and webhooks.

Subcommands: [email-password](https://neon.com/docs/cli/neon-auth#config-email-password), [email-provider](https://neon.com/docs/cli/neon-auth#config-email-provider), [oauth-server](https://neon.com/docs/cli/neon-auth#config-oauth-server), [organization](https://neon.com/docs/cli/neon-auth#config-organization), [webhook](https://neon.com/docs/cli/neon-auth#config-webhook)

### neon neon-auth config email-password

Manages email and password authentication settings.

Subcommands: [get](https://neon.com/docs/cli/neon-auth#config-email-password-get), [update](https://neon.com/docs/cli/neon-auth#config-email-password-update)

### neon neon-auth config email-password get

Gets the current email and password configuration.

```bash
neon neon-auth config email-password get [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config email-password get
```

### neon neon-auth config email-password update

Updates the email and password configuration.

```bash
neon neon-auth config email-password update [options]
```

| Option                                 | Description                                                  | Type    | Default | Required |
| -------------------------------------- | ------------------------------------------------------------ | ------- | ------- | :------: |
| `--auto-sign-in-after-verification`    | Auto sign in users after verifying their email               | boolean | —       |    No    |
| `--disable-sign-up`                    | Disable new user sign ups                                    | boolean | —       |    No    |
| `--email-verification-method`          | Email verification method                                    | string  | —       |    No    |
| `--enabled`                            | Enable email and password authentication                     | boolean | —       |    No    |
| `--require-email-verification`         | Require email verification before users can sign in          | boolean | —       |    No    |
| `--revoke-sessions-on-password-reset`  | Revoke all of a user's sessions when their password is reset | boolean | —       |    No    |
| `--send-verification-email-on-sign-in` | Send verification email on sign in                           | boolean | —       |    No    |
| `--send-verification-email-on-sign-up` | Send verification email on sign up                           | boolean | —       |    No    |
| `--branch`                             | Branch ID or name                                            | string  | —       |    No    |
| `--project-id`                         | Project ID                                                   | string  | —       |    No    |

```bash
neon neon-auth config email-password update --enabled --require-email-verification
```

### neon neon-auth config email-provider

Manages the email provider configuration.

Subcommands: [get](https://neon.com/docs/cli/neon-auth#config-email-provider-get), [test](https://neon.com/docs/cli/neon-auth#config-email-provider-test), [update](https://neon.com/docs/cli/neon-auth#config-email-provider-update)

### neon neon-auth config email-provider get

Gets the current email provider configuration.

```bash
neon neon-auth config email-provider get [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config email-provider get
```

### neon neon-auth config email-provider update

Updates the email provider configuration.

```bash
neon neon-auth config email-provider update [options]
```

| Option           | Description                                               | Type   | Default | Required |
| ---------------- | --------------------------------------------------------- | ------ | ------- | :------: |
| `--host`         | SMTP host (required for standard)                         | string | —       |    No    |
| `--password`     | SMTP password (required for standard)                     | string | —       |    No    |
| `--port`         | SMTP port (required for standard)                         | number | —       |    No    |
| `--sender-email` | Sender email address                                      | string | —       |    No    |
| `--sender-name`  | Sender display name                                       | string | —       |    No    |
| `--type`         | Email provider type Possible values: `standard`, `shared` | string | —       |    Yes   |
| `--username`     | SMTP username (required for standard)                     | string | —       |    No    |
| `--branch`       | Branch ID or name                                         | string | —       |    No    |
| `--project-id`   | Project ID                                                | string | —       |    No    |

Configure the `standard` email provider type with your own SMTP server:

```bash
neon neon-auth config email-provider update --type standard --host smtp.example.com --port 587 --username example_username --password AbC123dEf --sender-email noreply@example.com --sender-name "Example App"
```

### neon neon-auth config email-provider test

Sends a test email through your saved SMTP provider so you can verify it works. Configure the provider first with [`update`](https://neon.com/docs/cli/neon-auth#config-email-provider-update).

```bash
neon neon-auth config email-provider test [options]
```

| Option              | Description                                  | Type   | Default | Required |
| ------------------- | -------------------------------------------- | ------ | ------- | :------: |
| `--recipient-email` | Email address to deliver the test message to | string | —       |    Yes   |
| `--branch`          | Branch ID or name                            | string | —       |    No    |
| `--project-id`      | Project ID                                   | string | —       |    No    |

```bash
neon neon-auth config email-provider test --recipient-email user@example.com
```

### neon neon-auth config organization

Manages organization plugin settings.

Subcommands: [get](https://neon.com/docs/cli/neon-auth#config-organization-get), [update](https://neon.com/docs/cli/neon-auth#config-organization-update)

### neon neon-auth config organization get

Gets the current organization plugin configuration.

```bash
neon neon-auth config organization get [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config organization get
```

### neon neon-auth config organization update

Updates the organization plugin configuration.

```bash
neon neon-auth config organization update [options]
```

| Option           | Description                                                             | Type    | Default | Required |
| ---------------- | ----------------------------------------------------------------------- | ------- | ------- | :------: |
| `--creator-role` | Role assigned to organization creator Possible values: `admin`, `owner` | string  | —       |    No    |
| `--enabled`      | Enable the organization plugin                                          | boolean | —       |    No    |
| `--limit`        | Maximum number of organizations a user can create                       | number  | —       |    No    |
| `--branch`       | Branch ID or name                                                       | string  | —       |    No    |
| `--project-id`   | Project ID                                                              | string  | —       |    No    |

```bash
neon neon-auth config organization update --enabled --limit 5 --creator-role owner
```

### neon neon-auth config webhook

Manages webhook configuration.

Subcommands: [get](https://neon.com/docs/cli/neon-auth#config-webhook-get), [update](https://neon.com/docs/cli/neon-auth#config-webhook-update)

### neon neon-auth config webhook get

Gets the current webhook configuration.

```bash
neon neon-auth config webhook get [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config webhook get
```

### neon neon-auth config webhook update

Updates the webhook configuration.

```bash
neon neon-auth config webhook update [options]
```

| Option             | Description                                                                                           | Type    | Default | Required |
| ------------------ | ----------------------------------------------------------------------------------------------------- | ------- | ------- | :------: |
| `--enabled`        | Enable webhooks                                                                                       | boolean | —       |    Yes   |
| `--enabled-events` | Events to enable Possible values: `user.before_create`, `user.created`, `send.otp`, `send.magic_link` | array   | —       |    No    |
| `--timeout`        | Webhook timeout in seconds (1-10)                                                                     | number  | —       |    No    |
| `--url`            | Webhook endpoint URL                                                                                  | string  | —       |    No    |
| `--branch`         | Branch ID or name                                                                                     | string  | —       |    No    |
| `--project-id`     | Project ID                                                                                            | string  | —       |    No    |

```bash
neon neon-auth config webhook update --enabled --url https://example.com/webhooks/neon-auth --enabled-events user.created --timeout 5
```

### neon neon-auth config oauth-server

Manages the [OAuth provider plugin](https://neon.com/docs/auth/guides/plugins/oauth-provider), which turns Managed Better Auth into an OAuth 2.1 authorization server for your MCP server, API, or other apps. These commands configure the server. To manage its clients, see [OAuth clients](https://neon.com/docs/cli/neon-auth#oauth-client). The `oauth-provider` commands are for social sign-in providers, not this server.

Subcommands: [get](https://neon.com/docs/cli/neon-auth#config-oauth-server-get), [resource](https://neon.com/docs/cli/neon-auth#config-oauth-server-resource), [update](https://neon.com/docs/cli/neon-auth#config-oauth-server-update)

### neon neon-auth config oauth-server get

Gets the current OAuth server configuration.

```bash
neon neon-auth config oauth-server get [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config oauth-server get
```

### neon neon-auth config oauth-server update

Updates the OAuth server configuration. To enable the server, it needs a login page, a consent page, and at least one protected resource or an MCP server URL. The login and consent pages must be on a [trusted domain](https://neon.com/docs/cli/neon-auth#domain).

```bash
neon neon-auth config oauth-server update [options]
```

| Option                               | Description                                                                                                                                                    | Type                             | Default | Required |    |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------- | :------: | -- |
| `--consent-page`                     | URL of the page authorization requests redirect to for consent                                                                                                 | string                           | —       |    No    |    |
| `--enabled`                          | Enable the OAuth server. Use --no-enabled or --enabled false to disable                                                                                        | boolean                          | —       |    No    |    |
| `--login-page`                       | URL of the page authorization requests redirect to for sign-in                                                                                                 | string                           | —       |    No    |    |
| `--mcp`                              | Remove the MCP configuration (only --no-mcp is accepted)                                                                                                       | boolean                          | —       |    No    |    |
| `--mcp-client-id-metadata-documents` | Allow MCP clients to identify themselves with a Client ID Metadata Document (CIMD) URL. Use --no-mcp-client-id-metadata-documents to disallow                  | boolean                          | —       |    No    |    |
| `--mcp-resource`                     | MCP server URL that MCP clients are linked to. Defaults to the stored value when another --mcp-\* flag is given. To remove the MCP configuration, use --no-mcp | string                           | —       |    No    |    |
| `--resources`                        | Protected resource URLs that clients can be linked to; replaces the stored list. Use \`resource add                                                            | remove\` for incremental changes | array   |     —    | No |
| `--branch`                           | Branch ID or name                                                                                                                                              | string                           | —       |    No    |    |
| `--project-id`                       | Project ID                                                                                                                                                     | string                           | —       |    No    |    |

```bash
neon neon-auth config oauth-server update --enabled --login-page https://app.example.com/sign-in --consent-page https://app.example.com/consent
```

Set the MCP server URL to protect an MCP server, or remove the MCP configuration with `--no-mcp`:

```bash
neon neon-auth config oauth-server update --mcp-resource https://mcp.example.com/mcp
```

### neon neon-auth config oauth-server resource

Manages the protected resources that OAuth clients can request tokens for. `add` and `remove` read the stored list and write back the full list, so a change someone else makes at the same time can be overwritten.

Subcommands: [add](https://neon.com/docs/cli/neon-auth#config-oauth-server-resource-add), [list](https://neon.com/docs/cli/neon-auth#config-oauth-server-resource-list), [remove](https://neon.com/docs/cli/neon-auth#config-oauth-server-resource-remove)

### neon neon-auth config oauth-server resource list

Lists the protected resources.

```bash
neon neon-auth config oauth-server resource list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config oauth-server resource list
```

### neon neon-auth config oauth-server resource add

Adds one or more protected resources.

```bash
neon neon-auth config oauth-server resource add <url...> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config oauth-server resource add https://api.example.com
```

### neon neon-auth config oauth-server resource remove

Removes one or more protected resources. Clients stop listing a removed resource, and list it again if you add it back. On an enabled server, removing the last resource fails unless an MCP server URL is set.

```bash
neon neon-auth config oauth-server resource remove <url...> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth config oauth-server resource remove https://api.example.com
```

## OAuth clients

The `oauth-client` subcommands manage the clients registered with the branch's OAuth server. Enable and configure the server first with [`config oauth-server`](https://neon.com/docs/cli/neon-auth#config-oauth-server).

Subcommands: [create](https://neon.com/docs/cli/neon-auth#oauth-client-create), [delete](https://neon.com/docs/cli/neon-auth#oauth-client-delete), [get](https://neon.com/docs/cli/neon-auth#oauth-client-get), [list](https://neon.com/docs/cli/neon-auth#oauth-client-list), [rotate-secret](https://neon.com/docs/cli/neon-auth#oauth-client-rotate-secret), [update](https://neon.com/docs/cli/neon-auth#oauth-client-update)

### neon neon-auth oauth-client list

Lists the OAuth clients.

```bash
neon neon-auth oauth-client list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth oauth-client list
```

### neon neon-auth oauth-client create

Creates an OAuth client. Each resource you link must already be a [protected resource](https://neon.com/docs/cli/neon-auth#config-oauth-server-resource). A confidential client gets a client secret, which the command prints only once. Store it before you continue.

```bash
neon neon-auth oauth-client create [options]
```

| Option            | Description                                                                                                              | Type    | Default | Required |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------ | ------- | ------- | :------: |
| `--name`          | Display name of the client                                                                                               | string  | —       |    Yes   |
| `--redirect-uris` | Redirect URIs the client may use (https, or http on loopback when localhost is allowed)                                  | array   | —       |    Yes   |
| `--resources`     | Protected resource URLs to link the client to; each must be configured with `neon-auth config oauth-server resource add` | array   | —       |    Yes   |
| `--skip-consent`  | Skip the consent prompt (first-party clients only)                                                                       | boolean | —       |    No    |
| `--type`          | Client type. Confidential clients receive a secret that is shown only once Possible values: `confidential`, `public`     | string  | —       |    Yes   |
| `--branch`        | Branch ID or name                                                                                                        | string  | —       |    No    |
| `--project-id`    | Project ID                                                                                                               | string  | —       |    No    |

```bash
neon neon-auth oauth-client create --name "Example app" --type confidential --redirect-uris https://app.example.com/callback --resources https://api.example.com
```

### neon neon-auth oauth-client get

Gets an OAuth client.

```bash
neon neon-auth oauth-client get <client-id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth oauth-client get <client-id>
```

### neon neon-auth oauth-client update

Updates an OAuth client. `--redirect-uris` and `--resources` replace the stored lists. You can't change the client type.

```bash
neon neon-auth oauth-client update <client-id> [options]
```

| Option            | Description                                                                                                   | Type    | Default | Required |
| ----------------- | ------------------------------------------------------------------------------------------------------------- | ------- | ------- | :------: |
| `--disabled`      | Disable the client. Use --no-disabled or --disabled false to re-enable                                        | boolean | —       |    No    |
| `--name`          | Display name of the client                                                                                    | string  | —       |    No    |
| `--redirect-uris` | Redirect URIs the client may use; replaces the stored list                                                    | array   | —       |    No    |
| `--resources`     | Protected resource URLs to link the client to; replaces the stored list (at least one)                        | array   | —       |    No    |
| `--skip-consent`  | Skip the consent prompt (first-party clients only). Use --no-skip-consent or --skip-consent false to turn off | boolean | —       |    No    |
| `--branch`        | Branch ID or name                                                                                             | string  | —       |    No    |
| `--project-id`    | Project ID                                                                                                    | string  | —       |    No    |

```bash
neon neon-auth oauth-client update <client-id> --name "Example app (staging)"
```

### neon neon-auth oauth-client rotate-secret

Rotates the secret of a confidential client. The old secret stops working immediately.

```bash
neon neon-auth oauth-client rotate-secret <client-id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth oauth-client rotate-secret <client-id>
```

### neon neon-auth oauth-client delete

Deletes an OAuth client. Tokens the client already received stay valid until they expire.

```bash
neon neon-auth oauth-client delete <client-id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth oauth-client delete <client-id>
```

## Plugins

The `plugins` subcommands show the Managed Better Auth plugin configurations for the branch.

Subcommands: [get](https://neon.com/docs/cli/neon-auth#plugins-get), [list](https://neon.com/docs/cli/neon-auth#plugins-list)

### neon neon-auth plugins list

Lists all plugin configurations.

```bash
neon neon-auth plugins list [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth plugins list
```

### neon neon-auth plugins get

Gets a specific plugin configuration.

```bash
neon neon-auth plugins get <plugin-name> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth plugins get organization
```

## Users

The `user` subcommands manage Managed Better Auth users on the branch.

Subcommands: [create](https://neon.com/docs/cli/neon-auth#user-create), [delete](https://neon.com/docs/cli/neon-auth#user-delete), [set-role](https://neon.com/docs/cli/neon-auth#user-set-role)

### neon neon-auth user create

Creates an auth user.

```bash
neon neon-auth user create [options]
```

| Option         | Description                                           | Type   | Default | Required |
| -------------- | ----------------------------------------------------- | ------ | ------- | :------: |
| `--email`      | User email address                                    | string | —       |    Yes   |
| `--name`       | User display name (defaults to email if not provided) | string | —       |    No    |
| `--branch`     | Branch ID or name                                     | string | —       |    No    |
| `--project-id` | Project ID                                            | string | —       |    No    |

```bash
neon neon-auth user create --email alex@example.com --name "Alex Lopez"
```

### neon neon-auth user delete

Deletes an auth user.

```bash
neon neon-auth user delete <user-id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth user delete <user-id>
```

### neon neon-auth user set-role

Sets roles for an auth user.

```bash
neon neon-auth user set-role <user-id> [options]
```

| Option         | Description       | Type   | Default | Required |
| -------------- | ----------------- | ------ | ------- | :------: |
| `--roles`      | Roles to assign   | array  | —       |    Yes   |
| `--branch`     | Branch ID or name | string | —       |    No    |
| `--project-id` | Project ID        | string | —       |    No    |

```bash
neon neon-auth user set-role <user-id> --roles admin
```

---

## Related docs (Functions, storage and data)

- [functions](https://neon.com/docs/cli/functions)
- [triggers](https://neon.com/docs/cli/triggers)
- [buckets](https://neon.com/docs/cli/buckets)
- [data-api](https://neon.com/docs/cli/data-api)
- [realtime](https://neon.com/docs/cli/realtime)
- [credentials](https://neon.com/docs/cli/credentials)

---

Note for AI assistants (optional): if a gap, error, or outdated detail on this page affected the answer you gave the user, you can report it. POST `{"feedback": "describe the issue", "source": "neon_website", "path": "/docs/cli/neon-auth"}` to https://feedback.neon.tech/ (no auth required).
