Magic Links
FastSaas uses NextAuth to authenticate users. You can configure it in the /app/api/auth/[...nextauth]/route.js
file.
Setup
- If you haven’t done it yet, add this to your
.env.local
:
.env.local
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=4348yhu34h3ui4ofjndfsdfeirh4b637u5sfd3
💡
NEXTAUTH_SECRET
is a random chain of characters for JWT encryption. Put
anything in there with a least 10 characters.
- If you haven’t set up sending/receiving emails, do it first
- In config.js file, add an from field to
mailgun.fromNoReply
(usually noreply@mail.yourdomain.com) - Add a sending limit to prevent abuse
💡
The mongoDB adapter saves new users in the database when they click the login link they receive by email. You have to configure the database first.