Lightweight authentication server based on JSON Web Token. It contains users management, tokens management, logging.
- 1.1.0
- Node (currently: v12.18.2)
- Express 4
- MongoDB
- Passport
- Google ReCaptcha v3
- I18n
- pls, see config.js. Especially the database section.
$ git clone https://github.com/Kibo/Pimp.git
$ cd Pimp
$ npm install
$ npm start
- localhost:3000/init
- localhost:3000/login
- [email protected]
- 1234
Note:
- Delete init path after first login. It creates admin.
- Don't delete local token. You couldn't sign in.
$ npm test
| Env-variable | Description |
|---|---|
HOST_NAME |
The hostname, if not provided the default localhost will be used |
DB_USERNAME |
The username for the database connection, if not provided it does not use authentication. |
DB_PASSWORD |
The password for the database user |
DB_HOST |
The host IP address or DNS name without the port! If not provided the default localhost will be used |
DB_PORT |
The port of the mongoDB database, if not provided the default 27017 will be used |
DB_NAME |
The name of the database, if not provided the default pimp will be used |
REQUEST:{
Header:{
Content-Type:application/json
Accept:application/json
},
Body:{
"email": "[email protected]"
"password": "password"
"iss":"www.klient-app.com"
}
}
RESPONSE:{
status:200,
header:{
Content-Type:application/json
},
body:{
accessToken:"1234.4567.78910"
}
}
REQUEST:{
Header:{
Content-Type:application/json
Accept:application/json
Authorization:Bearer [JWT_TOKEN]
},
Body:{}
}
RESPONSE:{
status:200,
header:{
Content-Type:application/json
},
body:{
accessToken:"xxxxxxx.yyyyyyyy.zzzzzzzzz"
}
}
{
header:{
"alg": "HS256",
"typ": "JWT"
},
payload:{
iat:"token creation time",
iss:"domain name",
exp:"time until is valid",
user:{
firstname:"John",
lastname:"Deen"
email:"[email protected]",
roles:["role1", "role2"],
isActive:Boolean,
isNotification:Boolean,
}
},
signature:"zzzzzzzzz"
}
- Google ReCaptcha v3 to login, reset, signup forms
- I18n
