Authentication
Define the ways to login to your app
We use Auth.js
for the authentication.
Enable/disable login methods
All methods are enabled by default, change config at /configs/auth.ts
:
Setup auth methods
This method uses Resend
for sending login emails.
-
Create your
Resend
account. -
Go to
Resend Onboarding
and follow the guide to generate API key. -
Fill
AUTH_RESEND_KEY
andEMAIL_FROM
env vars in.env
.
If you are not adding a domain for Resend, you only can use
[email protected]
forEMAIL_FROM
, and only can login by Magic Link with email that you are using to register to Resend
You can go to
https://resend.com/logs
to see the logs if you cannot login with Magic link.
Secure
-
Remember to add a random string for
AUTH_SECRET
in.env
that uses to generate auth token. -
JWT max age.
Since the default setup is using JWT strategy
(our recommendation) instead of Session strategy
, so consider to config the suitable time to expire the tokens after a period of time in /configs/auth.ts
: