/APIs & SDKs/Checks, documents and data/optitech-auth

OptiTech CLI command: optitech-auth

Manage Managed Better Auth from the CLI

The optitech-auth command manages Managed Better Auth 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.

Requires optitech 2.23.0 or later. Check your version with optitech --version.

Subcommands: config, disable, domain, enable, oauth-provider, plugins, status, user

If --project-id or --branch are omitted, the CLI resolves them from your context file, auto-selects when there is only one option, and prompts otherwise.

Enable and status

optitech optitech-auth enable

Provisions Managed Better Auth on the current branch.

optitech optitech-auth enable [options]
OptionDescriptionTypeDefaultRequired
--database-nameDatabase name to use for auth datastringNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth enable

optitech optitech-auth status

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

optitech optitech-auth status [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth status

optitech optitech-auth disable

Removes Managed Better Auth from the branch.

optitech optitech-auth disable [options]
OptionDescriptionTypeDefaultRequired
--delete-dataPermanently delete all OptiTech Auth data and schema from the databasebooleanfalseNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo

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:

optitech optitech-auth disable --delete-data

OAuth providers

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

Subcommands: add, delete, list, update

optitech optitech-auth oauth-provider list

Lists the OAuth providers configured for the branch.

optitech optitech-auth oauth-provider list [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth oauth-provider list

optitech optitech-auth oauth-provider add

Adds an OAuth provider.

optitech optitech-auth oauth-provider add [options]
OptionDescriptionTypeDefaultRequired
--oauth-client-idOAuth client ID from your provider app. Omit to use OptiTech's shared OAuth app.stringNo
--oauth-client-secretOAuth client secret from your provider app. Omit to use OptiTech's shared OAuth app.stringNo
--provider-idOAuth provider ID. Supported values: google, github, vercelstringYes
--branchBranch ID or namestringNo
--project-idProject IDstringNo

Add the Google OAuth provider with your own credentials:

optitech optitech-auth oauth-provider add --provider-id google --oauth-client-id <client-id> --oauth-client-secret <client-secret>

optitech optitech-auth oauth-provider update

Updates the credentials for an existing OAuth provider.

optitech optitech-auth oauth-provider update [options]
OptionDescriptionTypeDefaultRequired
--oauth-client-idOAuth client ID from your provider app. Omit to use OptiTech's shared OAuth app.stringNo
--oauth-client-secretOAuth client secret from your provider app. Omit to use OptiTech's shared OAuth app.stringNo
--provider-idOAuth provider ID. Supported values: google, github, vercelstringYes
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth oauth-provider update --provider-id github --oauth-client-id <client-id> --oauth-client-secret <client-secret>

optitech optitech-auth oauth-provider delete

Deletes an OAuth provider from the branch.

optitech optitech-auth oauth-provider delete [options]
OptionDescriptionTypeDefaultRequired
--provider-idOAuth provider ID. Supported values: google, github, vercelstringYes
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-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, allow-localhost, delete, list

optitech optitech-auth domain list

Lists the trusted domains configured for the branch.

optitech optitech-auth domain list [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth domain list

optitech optitech-auth domain add

Adds a trusted domain.

optitech optitech-auth domain add <domain> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth domain add example.com

optitech optitech-auth domain delete

Deletes a trusted domain.

optitech optitech-auth domain delete <domain> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth domain delete example.com

optitech optitech-auth domain allow-localhost

Manages localhost connection settings for the branch.

Subcommands: disable, enable, get

optitech optitech-auth domain allow-localhost get

Gets the current localhost connection setting.

optitech optitech-auth domain allow-localhost get [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth domain allow-localhost get

optitech optitech-auth domain allow-localhost enable

Allows localhost connections for local development.

optitech optitech-auth domain allow-localhost enable [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth domain allow-localhost enable

optitech optitech-auth domain allow-localhost disable

Restricts localhost connections.

optitech optitech-auth domain allow-localhost disable [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-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, email-provider, organization, webhook

optitech optitech-auth config email-password

Manages email and password authentication settings.

Subcommands: get, update

optitech optitech-auth config email-password get

Gets the current email and password configuration.

optitech optitech-auth config email-password get [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config email-password get

optitech optitech-auth config email-password update

Updates the email and password configuration.

optitech optitech-auth config email-password update [options]
OptionDescriptionTypeDefaultRequired
--auto-sign-in-after-verificationAuto sign in users after verifying their emailbooleanNo
--disable-sign-upDisable new user sign upsbooleanNo
--email-verification-methodEmail verification methodstringNo
--enabledEnable email and password authenticationbooleanNo
--require-email-verificationRequire email verification before users can sign inbooleanNo
--send-verification-email-on-sign-inSend verification email on sign inbooleanNo
--send-verification-email-on-sign-upSend verification email on sign upbooleanNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config email-password update --enabled --require-email-verification

optitech optitech-auth config email-provider

Manages the email provider configuration.

Subcommands: get, test, update

optitech optitech-auth config email-provider get

Gets the current email provider configuration.

optitech optitech-auth config email-provider get [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config email-provider get

optitech optitech-auth config email-provider update

Updates the email provider configuration.

optitech optitech-auth config email-provider update [options]
OptionDescriptionTypeDefaultRequired
--hostSMTP host (required for standard)stringNo
--passwordSMTP password (required for standard)stringNo
--portSMTP port (required for standard)numberNo
--sender-emailSender email addressstringNo
--sender-nameSender display namestringNo
--typeEmail provider type Possible values: standard, sharedstringYes
--usernameSMTP username (required for standard)stringNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo

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

optitech optitech-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"

optitech optitech-auth config email-provider test

Sends a test email so you can verify your SMTP configuration.

optitech optitech-auth config email-provider test [options]
OptionDescriptionTypeDefaultRequired
--hostSMTP hoststringYes
--passwordSMTP passwordstringYes
--portSMTP portnumberYes
--recipient-emailEmail address to send test email tostringYes
--sender-emailSender email addressstringYes
--sender-nameSender display namestringYes
--usernameSMTP usernamestringYes
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config email-provider test --recipient-email user@example.com --host smtp.example.com --port 587 --username example_username --password AbC123dEf --sender-email noreply@example.com --sender-name "Example App"

optitech optitech-auth config organization

Manages organization plugin settings.

Subcommands: get, update

optitech optitech-auth config organization get

Gets the current organization plugin configuration.

optitech optitech-auth config organization get [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config organization get

optitech optitech-auth config organization update

Updates the organization plugin configuration.

optitech optitech-auth config organization update [options]
OptionDescriptionTypeDefaultRequired
--creator-roleRole assigned to organization creator Possible values: admin, ownerstringNo
--enabledEnable the organization pluginbooleanNo
--limitMaximum number of organizations a user can createnumberNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config organization update --enabled --limit 5 --creator-role owner

optitech optitech-auth config webhook

Manages webhook configuration.

Subcommands: get, update

optitech optitech-auth config webhook get

Gets the current webhook configuration.

optitech optitech-auth config webhook get [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config webhook get

optitech optitech-auth config webhook update

Updates the webhook configuration.

optitech optitech-auth config webhook update [options]
OptionDescriptionTypeDefaultRequired
--enabledEnable webhooksbooleanYes
--enabled-eventsEvents to enable Possible values: user.before_create, user.created, send.otp, send.magic_linkstringNo
--timeoutWebhook timeout in seconds (1-10)numberNo
--urlWebhook endpoint URLstringNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth config webhook update --enabled --url https://example.com/webhooks/optitech-auth --enabled-events user.created --timeout 5

Plugins

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

Subcommands: get, list

optitech optitech-auth plugins list

Lists all plugin configurations.

optitech optitech-auth plugins list [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth plugins list

optitech optitech-auth plugins get

Gets a specific plugin configuration.

optitech optitech-auth plugins get <plugin-name> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth plugins get organization

Users

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

Subcommands: create, delete, set-role

optitech optitech-auth user create

Creates an auth user.

optitech optitech-auth user create [options]
OptionDescriptionTypeDefaultRequired
--emailUser email addressstringYes
--nameUser display name (defaults to email if not provided)stringNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth user create --email alex@example.com --name "Alex Lopez"

optitech optitech-auth user delete

Deletes an auth user.

optitech optitech-auth user delete <user-id> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth user delete <user-id>

optitech optitech-auth user set-role

Sets roles for an auth user.

optitech optitech-auth user set-role <user-id> [options]
OptionDescriptionTypeDefaultRequired
--rolesRoles to assignstringYes
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech optitech-auth user set-role <user-id> --roles admin
Was this page helpful?

On this page

Copy neon init command