Docs
Authentification

Authentification

How to config the authentification.

The auth part is similar at the authjs documentation. You can follow the official documentation here if you want.

After upgrade Auth.js to v5: NEXTAUTH_URL has removed from .env file. Same thing in production.

Update auth_secret variable

The only environment variable that is mandatory is the AUTH_SECRET. This is a random value used by the library to encrypt tokens and email verification hashes. You can generate one via running:

npx auth secret

Alternatively, you can use the openssl CLI, openssl rand -base64 33.

Then add it to your .env file:

.env.local
AUTH_SECRET = secret;

Google config

In this section, you can update these variables:

.env
GOOGLE_CLIENT_ID = your_secret_client_id.apps.googleusercontent.com;
GOOGLE_CLIENT_SECRET = your_secret_client;

See config tutorial in Authjs - Google OAuth.

Github config

In this section, you can update these variables:

.env
GITHUB_ID = your_secret_client_id;
GITHUB_SECRET = your_secret_client;

See config tutorial in Authjs - Github OAuth.