Configuration
Authentification
Configure the authentification with Sidebase Auth.
Application URL
Before configuring the authentification, you need to set the NUXT_APP_URL
environment variable in your .env
file.
For exemple in development, you can set the URL to http://localhost:3000
.
NUXT_APP_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.
NUXT_AUTH_SECRET=your_secret_key
You can generate a secret key using openssl
CLI with the following command:
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.
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.
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
Credentials
tab. - Click on
Create credentials
and selectOAuth client ID
. - Select
Web application
as 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 ID
andClient Secret
and paste them into your.env
file.