Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
mock-user-auth
Advanced tools
Readme
Mock-User-Auth is a mock user authentication API developed in Nodejs and Express using JWT as an authenticator in the ES6 version of JavaScript.
The use: It can be used to assist your front-end development. It's simple and fast, you just need to follow the steps below.
Toolkit: Node.js | Express.js | Mocha | Chai | Istanbul
1 - Install package:
$ npm i --save mock-user-auth
2 - Create script in package.json:
{
"script": {
"dev": "nodemon ./node_modules/mock-user-auth/bin/www.js"
}
}
3 - Start api:
$ npm run dev
Option: You can set the port after npm command:
$ npm run dev 8080
Obs.: The following instructions were tested on Ubuntu distribution.
1 - After 'git clone' command, run the following commands to install dependencies:
2 - Start application
Action | Required | Method | URL |
---|---|---|---|
AUTHENTICATE USER | POST | /api/v1/auth | |
CREATE USER | POST | /api/v1/users | |
GET USER | Auth | GET | /api/v1/users |
PATCH USER | Auth | PATCH | /api/v1/users |
DELETE USER | Auth | DELETE | /api/v1/users |
DELETE ALL USERS | DELETE | /api/v1/users |
POST /api/v1/auth
{
"email": "user@gmail.com",
"password": "user123"
}
{
"token": "eyJhbGciOiJI..."
}
POST /api/v1/users
{
"name": "user",
"email": "user@gmail.com",
"password": "user123"
}
{
"message": "User registered with success",
"token": "eyJhbGciOiJI..."
}
GET /api/v1/users
const token = 'eyJhbGciOiJI...';
req.setRequestHeader('Authorization', token);
{
"id": 46643,
"name": "user",
"email": "user@gmail.com",
"password": "user123",
"imageUrl": "https://almsaeedstudio.com/themes/AdminLTE/dist/img/user2-160x160.jpg"
}
PATCH /api/v1/users
const token = 'eyJhbGciOiJI...';
req.setRequestHeader('Authorization', token);
{
"name": "newName",
"email": "new_email@gmail.com",
"password": "newpassword123"
}
{
"message": "User updated with success"
}
DELETE /api/v1/users
const token = 'eyJhbGciOiJI...';
req.setRequestHeader('Authorization', token);
{
"message": "User deleted with success"
}
DELETE /api/v1/all-users
{
"key_admin": "keyadmin123"
}
{
"message": "Users deleted with success"
}
This project is licensed under the MIT License - see the LICENSE.md file for details
Created By ThiagoLuizNunes 2019.
FAQs
Mock-User-Auth is a mock user authentication API developed in Nodejs and Express using JWT as authenticator
We found that mock-user-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).