Configure

Learn how to set up authentication with Better Auth.

Generate Secret Key

The secret key is used to encrypt session tokens and sign cookies.

Generate a secret key

Run the following command:

openssl rand -base64 32

Update the environment variables

Replace the BETTER_AUTH_SECRET in the .env file with the generated secret key.

Also ensure BETTER_AUTH_URL points to your dashboard application:

.env
BETTER_AUTH_URL=http://localhost:3000
BETTER_AUTH_SECRET=your-generated-secret-here

Configure Authentication Providers

In the next sections, we will configure the authentication providers:

You can enable or disable any provider through feature flags.