Basic Saas Kit
Authentication

Authentication

LaunchCode utilizes Auth.js for authentication. The configuration can be found in the src/lib/auth.ts file.

To generate a next-auth secret, run the following command:

openssl rand -base64 32

Copy the generated secret and add it to your .env.local file:

NEXTAUTH_SECRET=

Also update the NextAuth URL in the .env.local file:

NEXTAUTH_URL=http://localhost:3000

When deploying to production, replace the URL with your own domain.

By default, Magic links and Google OAuth are enabled. You can enable additional providers by following the auth.js (opens in a new tab) documentation.

Magic Links

For Magic links, we use Resend (opens in a new tab) to send emails. for sending emails. You can configure Resend in the src/email/index.ts file.

Get your Resend API key from the Resend API KEY (opens in a new tab) and add it to your .env.local file:

RESEND_API_KEY=

Now for the send email functionality to work, you need to add your domain to the Resend domains (opens in a new tab).

Google OAuth

o use Google OAuth, create a project in the Google Developer Console. Then, add the following environment variables to your .env.local file:

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=