Authentification
Configure the authentification with Sidebase Auth.
Application URL
Before configuring the authentification, you need to set the NUXT_PUBLIC_SITE_URL environment variable in your .env file.
For exemple in development, you can set the URL to http://localhost:3000.
.env
NUXT_PUBLIC_SITE_URL=http://localhost:3000
Auth Secret environment variable
To configure the authentification with Sidebase Auth, you need to set the NUXT_AUTH_SECRET environment variable in your .env file.
.env
NUXT_AUTH_SECRET=your_secret_key
You can generate a secret key using openssl CLI with the following command:
Terminal
openssl rand -base64 33
Or use this this online tool to generate a secret key
Auth Origin
For production only, you also need to set the AUTH_ORIGIN environment variable in your .env file.
.env
AUTH_ORIGIN=your-website-url
Google Provider
To enable the Google provider, you need to set the NUXT_GOOGLE_CLIENT_ID and NUXT_GOOGLE_CLIENT_SECRET environment variables in your .env file.
.env
NUXT_GOOGLE_CLIENT_ID=your_google_client_id
NUXT_GOOGLE_CLIENT_SECRET=your_google_client_secret
Get the Google Client ID and Client Secret
- Go to the Google Developers Console.
- Create a new project or select an existing project.
- Go to the
Credentialstab. - Click on
Create credentialsand selectOAuth client ID. - Select
Web applicationas the application type. - Add your authorized JavaScript origins and redirect URIs.
- Authorized JavaScript origins is your
{NUXT_PUBLIC_APP_URL}- For exemple:
http://localhost:3000
- For exemple:
- Authorized redirect URIs is your
{NUXT_PUBLIC_APP_URL}/api/auth/callback/google- For exemple:
http://localhost:3000/api/auth/callback/google
- For exemple:
- Authorized JavaScript origins is your
- Copy the
Client IDandClient Secretand paste them into your.envfile.