PotaLab
← All examples
SnippetAuthNext.js

Magic-link sign-in

The form requests a magic link. The callback page exchanges the code (PKCE) and copies the session into the Next.js cookie so Server Components see the user. Enable magic links in the dashboard and allow your redirect URL first.

localhost:3000/login

Sign in

We will email you a link. No password needed.

The link opens /auth/callback?code=..., which exchanges the code (PKCE) for a session.

Preview · sample data

Snippet for illustration, written for the Next.js App Router with @potalab/base/next,@potalab/base/react and @potalab/base. Set NEXT_PUBLIC_POTALAB_BASE_URL andNEXT_PUBLIC_POTALAB_BASE_KEY, adapt names and redirect URLs, and review policies before production.

Next: Multi-tenant SaaS starter →