https://github.com/matter-in-motion/mm-user-auth-passwordless
User passwordless authentication via email
https://github.com/matter-in-motion/mm-user-auth-passwordless
api authentication extension matter-in-motion passwordless
Last synced: 7 months ago
JSON representation
User passwordless authentication via email
- Host: GitHub
- URL: https://github.com/matter-in-motion/mm-user-auth-passwordless
- Owner: matter-in-motion
- Created: 2017-12-31T19:30:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-26T18:46:14.000Z (about 8 years ago)
- Last Synced: 2025-01-30T12:03:35.449Z (over 1 year ago)
- Topics: api, authentication, extension, matter-in-motion, passwordless
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Matter In Motion. User passwordless authentication via email extension
[](https://www.npmjs.com/package/mm-user-auth-passwordless)
[](https://www.npmjs.com/package/mm-user-auth-passwordless)
This extension adds a **passwordless** method to authenticate users in your app. It works like this:
1. User enters email
2. App sends a token to user's email
3. User clicks on the link inside the email
4. The app checks the token and returns an authentication token
5. Done!
## Usage
[Extensions installation instructions](https://github.com/matter-in-motion/mm/blob/master/docs/extensions.md)
## Dependencies
* __[user](https://github.com/matter-in-motion/mm-user)__
* __[mail](https://github.com/matter-in-motion/mm-mail)__
## Settings
First, you need to define user authentication provider as [here](https://github.com/matter-in-motion/mm/blob/master/docs/authentication.md)
This extension adds settings to the user settings.
* **login**
- expiresIn: '15 mins' — string, login token expiration time
- subject — string, login token email subject (Tip: if no subject defined `mail` takes the subject from the `` tag in the email)
- template — string, the path to login token email template
## API
### user.sendAuthentication
Sends authentication token to the email
**Request**
* **email** — user's email
* data — additional data to add to the token
- redirect — redirect URL. You can use it to return a user to the page he logged in from.
**Response**
* true — if token send
* `NotFound` error, code 4540 — when user not found
### user.authenticate
Authenticates the user and returns authentication token to use with API.
**Request**
token from email
**Response**
* **token** — authentication token
* **expires** — timestamp when token will expire
* redirect — URL, where the user logged in from
* `Unauthorized` error, code 4100 — when no user authenticated
License MIT;