Enables a secure and seamless emailed link authentication experience.
A plugin for Strapi Headless CMS that provides ability to sign-in/sign-up to an application by link had sent to email. A plugin works together with Strapi User Permissions Plugin and extends it functionality. For working with emails a plugin use Strapi Email Plugin.
Install Strapi with this Quickstart command to create a Strapi project instantly:
# with yarn
yarn create strapi-app my-project --quickstart
# with npm/npx
npx create-strapi-app my-project --quickstart
Configure the Strapi email
plugin ( official documentation )
Add the strapi-plugin-passwordless
plugin
yarn add strapi-plugin-passwordless@latest
# or
npm i -S strapi-plugin-passwordless@latest
yarn build && yarn develop
# or
npm run build && npm run develop
--watch-admin
option:yarn develop --watch-admin
#or
npm run develop --watch-admin
The Passwordless plugin should appear in the Plugins section of Strapi sidebar after you run app again.
1POST /api/passwordless/send-link
2{
3 "email": "user@email.com"
4 "username": "John Bull" // username for new user
5 "context": {
6 // context of authentification, optional parameter e.g. "currentUrl": "...my page..."
7 ...
8 }
9}
Send mail to user by username
1POST /api/passwordless/send-link
2{
3 "username": "John Bull"
4}
1GET /api/passwordless/login?loginToken={tokenFromEmail}
Response:
1{
2 "jwt": "...jwt auth token..."
3 "user": {
4 ...strapi user...
5 },
6 "context": {
7 ... context, provided to sendlink, e.g. currentPage, sessionId etc.
8 }
9}
WIP
strapi-plugin-passwordless@4.x
- version for strapi v4strapi-plugin-passwordless@3.x
- version for strapi v3 (dev branch) Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!
Give a star if this project helped you.
MIT License Copyright (c) Andrey Kucherenko.
npm install strapi-plugin-passwordless
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.