Authentication
Launch Express uses NextAuth.js v5 for authentication. The configuration is done in the config/auth.js
file.
To create a next-auth secret key, run the following command:
This will generate a secret key that you can use in your .env
file.
Also update the NEXTAUTH_URL
in your .env
file to match your domain.
Replace http://localhost:3000
with your domain if you are deploying to production.
Google OAuth
To enable Google OAuth, you need to create a new project in the Google Developer Console.
-
Go to the Google Developer Console.
-
Create a new project.
-
Go to the
OAuth consent screen
and fill in the required fields. -
Go to the
Credentials
tab and create a new OAuth client ID. -
Add the client ID and client secret to your
.env
file.
Magic Link
To enable Magic Link, you need a email provider. We are using Resend in this Boilerplate.
-
Go to Resend and create an account.
-
Go to the
Settings
tab and copy the API key. -
Add the API key to your
.env
file.
You also need to add your domain to the Resend Domains.
Now for the functionality to work, you need to add the following code to your config/config.ts
file and set also the additionalAuthMethod
to magic-link
.
You get the infos from the Resend SMTP page.
You can also change this to your own SMTP provider.