Plugin to extend the basic auth system for feathersjs adding
- Password less Authentication
- Verify Email on Signup (if not password less)
- Refresh Tokens
To make it easy to work with, I have not removed access to the built in authentication service which can still be set up with things like oauth, you can also set your own auth path in the config
npm install feathers-auth-extend --save
"feathers-mail": {
"from": "[email protected]",
"smtp": {
"host": "smtp.host.here",
"secure": true,
"auth": {
"user": "[email protected]",
"pass": "replacewithpassword"
}
}
},
"feathers-auth-extend": {
"name": "API NAME",
"route": "/auth",
"magicTokens": true,
"refreshTokens": true,
"refreshExpires": "30d",
"securePasswords": true,
"zxcvbn": 3,
"user": {
"verifyEmail": true,
"keepBefore": ["email", "password", "createdAt", "updatedAt"],
"keepAfter": ["_id", "id"]
}
}
If you wish to capture other items in your create account process, add them to user.KeepBefore.
If you wish to output user items after successful login, add them to user.Keepafter
####Install plugin in app.js after "app.configure(channels);"
// auth extend plugin
app.configure(require('feathers-auth-extend'));
GET Request:
https://api.url/authManage/[email protected]
This will then email an auth token that can be used as below
POST https://api.url/auth
{
"action": "loginToken",
"email": "[email protected]",
"login_token": "CodEHeRe"
}
This will login the user and mark them as a verified User
POST https://api.url/auth
{
"action": "refresh",
"refresh_token": "refrehstokengoeshere.........."
}
This will issue a new auth token to the default amount set up in your config
POST https://api.url/authManage
{
"action": "verifyAccount",
"email": "[email protected]",
"token": "CodEhERe"
}
POST https://api.url/authManage
{
"action": "resetPassword",
"email": "[email protected]"
}
POST https://api.url/authManage
{
"action": "verifyReset",
"email": "[email protected]",
"token": "CodEhERe",
"password": "SeCUREPassHERE"
}
Copyright (c) 2020
Licensed under the MIT license.