.. | ||
components | ||
lib | ||
pages | ||
public | ||
.env.local.example | ||
.gitignore | ||
next.config.js | ||
package.json | ||
README.md | ||
tsconfig.json |
Authsignal Passwordless Login Example
This example shows how to integrate Authsignal with Next.js in order to implement passwordless login using email magic links and server-side redirects.
The login session is managed using cookies. Session data is encrypted using @hapi/iron.
A live version of this example can be found here.
Deploy your own
Deploy the example using Vercel:
How to use
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example authsignal/passwordless-login authsignal-passwordless-app
# or
yarn create next-app --example authsignal/passwordless-login authsignal-passwordless-app
# or
pnpm create next-app --example authsignal/passwordless-login authsignal-passwordless-app
Deploy it to the cloud with Vercel (Documentation).
Configuration
Log in to the Authsignal Portal and enable email magic links for your tenant.
Copy the .env.local.example file to .env.local:
cp .env.local.example .env.local
Set AUTHSIGNAL_SECRET
as your Authsignal secret key.
The SESSION_TOKEN_SECRET
is used to encrypt the session cookie. Set it to a random string of 32 characters.
Notes
To learn more about Authsignal take a look at the API Documentation.