Adds email-based magic link login to Payload. Links are signed with a JWT secret and sent through Payload's email configuration to targets such as the admin panel or a mobile app deep link. The plugin currently creates its own user collection with email and salt/hash, and it requires email transport options and a server URL in the config. It targets Payload 2.x and is marked as under active development.
A Magic Login plugin for Payload CMS
Installation
npm i payload-magic-login3
Stars
0
Forks
1
Open Issues
2 years ago
Last Updated
25
Weekly Downloads
v1.1.0
npm Version
122.6 KB
Unpacked Size
3
Dependencies
30 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 3 |
| Dec 5, 2026 | 3 |
| Dec 4, 2026 | 3 |
| Dec 3, 2026 | 3 |
| Dec 2, 2026 | 3 |
| Dec 1, 2026 | 3 |
| Nov 30, 2026 | 3 |
| Nov 29, 2026 | 3 |
| Nov 28, 2026 | 3 |
| Nov 27, 2026 | 3 |
| Nov 26, 2026 | 3 |
| Nov 25, 2026 | 3 |
| Nov 24, 2026 | 3 |
| Nov 23, 2026 | 3 |
| Nov 22, 2026 | 3 |
| Nov 21, 2026 | 3 |
| Nov 20, 2026 | 3 |
| Nov 19, 2026 | 3 |
| Nov 18, 2026 | 3 |
| Nov 17, 2026 | 3 |
| Nov 16, 2026 | 3 |
| Nov 15, 2026 | 3 |
| Nov 14, 2026 | 3 |
| Nov 13, 2026 | 3 |
| Nov 12, 2026 | 3 |
| Nov 11, 2026 | 3 |
| Nov 10, 2026 | 3 |
| Nov 9, 2026 | 3 |
| Nov 8, 2026 | 3 |
| Nov 7, 2026 | 3 |
| Nov 6, 2026 | 3 |
| Nov 5, 2026 | 3 |
| Nov 4, 2026 | 3 |
| Nov 3, 2026 | 3 |
| Nov 2, 2026 | 3 |
| Nov 1, 2026 | 3 |
| Oct 31, 2026 | 3 |
| Oct 30, 2026 | 3 |
| Oct 29, 2026 | 3 |
| Oct 28, 2026 | 3 |
| Oct 27, 2026 | 3 |
| Oct 26, 2026 | 3 |
| Oct 25, 2026 | 3 |
| Oct 24, 2026 | 3 |
| Oct 23, 2026 | 3 |
| Oct 22, 2026 | 3 |
| Oct 21, 2026 | 3 |
| Oct 20, 2026 | 3 |
| Oct 19, 2026 | 3 |
| Oct 18, 2026 | 3 |
| Oct 17, 2026 | 3 |
| Oct 16, 2026 | 3 |
| Oct 15, 2026 | 3 |
| Oct 14, 2026 | 3 |
| Oct 13, 2026 | 3 |
| Oct 12, 2026 | 3 |
| Oct 11, 2026 | 3 |
| Oct 10, 2026 | 3 |
| Oct 9, 2026 | 3 |
| Oct 8, 2026 | 3 |
| Oct 7, 2026 | 3 |
| Oct 6, 2026 | 3 |
| Oct 5, 2026 | 3 |
| Oct 4, 2026 | 3 |
| Oct 3, 2026 | 3 |
| Oct 2, 2026 | 3 |
| Oct 1, 2026 | 3 |
| Sep 30, 2026 | 3 |
| Sep 29, 2026 | 3 |
| Sep 28, 2026 | 3 |
| Sep 27, 2026 | 3 |
| Sep 26, 2026 | 3 |
| Sep 25, 2026 | 3 |
| Sep 24, 2026 | 3 |
| Sep 23, 2026 | 3 |
| Sep 22, 2026 | 3 |
| Sep 21, 2026 | 3 |
| Sep 20, 2026 | 3 |
| Sep 19, 2026 | 3 |
| Sep 18, 2026 | 3 |
| Sep 17, 2026 | 3 |
| Sep 16, 2026 | 3 |
| Sep 15, 2026 | 3 |
| Sep 14, 2026 | 3 |
| Sep 13, 2026 | 3 |
| Sep 12, 2026 | 3 |
| Sep 11, 2026 | 3 |
| Sep 10, 2026 | 3 |
| Sep 9, 2026 | 3 |
| Sep 8, 2026 | 3 |
| Sep 7, 2026 | 3 |
26+17 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 26 |
| Dec 5, 2026 | 19 |
| Dec 4, 2026 | 2 |
| Dec 3, 2026 | 4 |
| Dec 2, 2026 | 6 |
| Dec 1, 2026 | 10 |
| Nov 30, 2026 | 17 |
| Nov 29, 2026 | 34 |
| Nov 28, 2026 | 35 |
| Nov 27, 2026 | 38 |
| Nov 26, 2026 | 36 |
| Nov 25, 2026 | 34 |
| Nov 24, 2026 | 32 |
| Nov 23, 2026 | 25 |
| Nov 22, 2026 | 9 |
| Nov 21, 2026 | 9 |
| Nov 20, 2026 | 6 |
| Nov 19, 2026 | 9 |
| Nov 18, 2026 | 16 |
| Nov 17, 2026 | 14 |
| Nov 16, 2026 | 15 |
| Nov 15, 2026 | 13 |
| Nov 14, 2026 | 14 |
| Nov 13, 2026 | 16 |
| Nov 12, 2026 | 21 |
| Nov 11, 2026 | 14 |
| Nov 10, 2026 | 14 |
| Nov 9, 2026 | 14 |
| Nov 8, 2026 | 15 |
| Nov 7, 2026 | 13 |
| Nov 6, 2026 | 10 |
| Nov 5, 2026 | 3 |
| Nov 4, 2026 | 3 |
| Nov 3, 2026 | 4 |
| Nov 2, 2026 | 8 |
| Nov 1, 2026 | 9 |
| Oct 31, 2026 | 23 |
| Oct 30, 2026 | 31 |
| Oct 29, 2026 | 30 |
| Oct 28, 2026 | 30 |
| Oct 27, 2026 | 30 |
| Oct 26, 2026 | 27 |
| Oct 25, 2026 | 25 |
| Oct 24, 2026 | 12 |
| Oct 23, 2026 | 4 |
| Oct 22, 2026 | 5 |
| Oct 21, 2026 | 7 |
| Oct 20, 2026 | 6 |
| Oct 19, 2026 | 4 |
| Oct 18, 2026 | 4 |
| Oct 17, 2026 | 4 |
| Oct 16, 2026 | 5 |
| Oct 15, 2026 | 5 |
| Oct 14, 2026 | 3 |
| Oct 13, 2026 | 3 |
| Oct 12, 2026 | 3 |
| Oct 11, 2026 | 4 |
| Oct 10, 2026 | 3 |
| Oct 9, 2026 | 2 |
| Oct 8, 2026 | 1 |
| Oct 7, 2026 | 1 |
| Oct 6, 2026 | 1 |
| Oct 5, 2026 | 1 |
| Oct 4, 2026 | 3 |
| Oct 3, 2026 | 3 |
| Oct 2, 2026 | 4 |
| Oct 1, 2026 | 7 |
| Sep 30, 2026 | 7 |
| Sep 29, 2026 | 15 |
| Sep 28, 2026 | 15 |
| Sep 27, 2026 | 13 |
| Sep 26, 2026 | 16 |
| Sep 25, 2026 | 15 |
| Sep 24, 2026 | 13 |
| Sep 23, 2026 | 13 |
| Sep 22, 2026 | 15 |
| Sep 21, 2026 | 17 |
| Sep 20, 2026 | 17 |
| Sep 19, 2026 | 16 |
| Sep 18, 2026 | 16 |
| Sep 17, 2026 | 16 |
| Sep 16, 2026 | 17 |
| Sep 15, 2026 | 7 |
| Sep 14, 2026 | 8 |
| Sep 13, 2026 | 7 |
| Sep 12, 2026 | 6 |
| Sep 11, 2026 | 6 |
| Sep 10, 2026 | 5 |
| Sep 9, 2026 | 5 |
| Sep 8, 2026 | 9 |
| Sep 7, 2026 | 9 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/748450764-root)<a href="https://payloaddirectory.dev/plugins/748450764-root"><img src="https://payloaddirectory.dev/badge/748450764-root.svg" alt="Payload Directory"></a>README
This is built with the Payload CMS plugin template.
First install it with npm install payload-magic-login (or your preferred package manager).
To then install this plugin, simply add it to your payload.config() in the Plugin array.
import magicLoginPlugin from 'payload-magic-login';
export const config = buildConfig({
plugins: [
// You can pass options to the plugin
magicLoginPlugin({
secret: process.env.PAYLOAD_SECRET, // A secret used to sign the JWTs
payload: payload, // Your payload instance
enabled: true,
targets: [
{
target: "app-dev",
uri: "exp://my-app-dev.exp.direct",
subject: "GetRekd: Login Link",
html: (link) => `Click this link to finish logging in: <a href="${link}">LOGIN LINK</a>, if you can't click the link, copy and paste this link into your browser: \n\n${link}`
},
]
})
]
});
// payload.config.ts
...
email: {
fromName: 'Oscar - GetRekd app',
fromAddress: '[email protected]',
// You can use the ethereal mail in dev,
// but requires some sort of transport options for actual emails (See Payload Docs)
transportOptions: {
host: process.env.SMTP_HOST,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
port: process.env.SMTP_PORT,
secure: Number(process.env.SMTP_SECURE) === 465,
requireTLS: Number(process.env.SMTP_SECURE) === 587,
}
},
// It will redirect to this URL
serverURL: process.env.SERVER_URL || 'http://localhost:3000',
...
At this moment, it creates a user collection for you - with an email and salt/hash (plan is to support this alongside local auth, working on that). I will add support to extend this or have it update the given collection at a later date.
In the dev folder, you’ll find a basic payload project, created with npx create-payload-app.
The magicLoginPlugin has already been installed to the payload.config() file in this project.
plugins: [
magicLoginPlugin({
secret: process.env.PAYLOAD_SECRET, // A secret used to sign the JWTs
payload: payload, // Your payload instance
enabled: true,
// Targets are used to determine where the link should point to.
// For example: target: "admin" (default) creates a link to the admin panel.
// The targets "app" and "app-dev" could be for opening the link in an app.
targets: [
{
target: "app",
uri: "exp://my-app.exp.direct",
subject: "GetRekd: Login Link",
html: (link) => `Click this link to finish logging in: <a href="${link}">LOGIN LINK</a>, if you can't click the link, copy and paste this link into your browser: ${link}`
},
{
target: "app-dev",
uri: "exp://my-app-dev.exp.direct",
subject: "GetRekd: Login Link",
html: (link) => `Click this link to finish logging in: <a href="${link}">LOGIN LINK</a>, if you can't click the link, copy and paste this link into your browser: \n\n${link}`
},
]
})
]
When you’re ready to start development, navigate into this folder with cd dev
And then start the project with yarn dev and pull up http://localhost:3000/ in your browser.
These are the current types/options for the plugin.
export interface PluginTypes {
/**
* Enable or disable plugin
* @default false
*/
enabled?: boolean
/**
* Secret used to sign JWTs
*/
secret: string
/**
* The payload instance
* @default payload
*/
payload: Payload
/**
* Your own custom targets:
* @default []
* @example
* targets: [
* {
* target: "app",
* uri: "exp://my-app.example.com",
* subject: "GetRekd: Login Link",
* html: `Click this link to finish logging in: <a href="${link}">LOGIN LINK</a>, if you can't click the link, copy and paste this link into your browser: ${link}`
* },
* {
* target: "admin",
* uri: "https://admin.getrekd.lol",
* subject: "GetRekd: Login Link",
* html: `Click this link to finish logging in: <a href="${link}">LOGIN LINK</a>, if you can't click the link, copy and paste this link into your browser: ${link}`
* }
* ]
*/
`targets?: Array<{ target: string, uri: string, subject: string, html: (link: string) => string }>`
}
I will implement tests shortlyTM.
Feel free to submit PRs and suggestions, the code isn't perfect by any means and is provided as-is.
oidc
OpenID Connect single sign-on for Payload using Authorization Code Flow with PKCE and native Payload sessions
65745/wk0v3
payload subscribers plugin
Subscriber management with magic link and one-time code sign-in plus opt-in channels
5469/wk3v3
payload auth pwless
Passwordless login for Payload with passkeys, magic links, OAuth and refresh-token sessions
4214/wk2v3
payload better auth
Better Auth database adapter and plugins that run authentication through Payload collections
9011.9k/wk77v3 v4
payload authjs
Sign in to Payload CMS through Auth.js 5 providers and use the Auth.js session as the Payload user
903.1k/wk206v3
payload zitadel plugin
Log in to the Mzinga admin through Zitadel or another OIDC provider using authorization code with PKCE
72608/wk11v?