Skip to content

nikdiklic/jwt-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONServer + JWT Auth

A Fake REST API using json-server with JWT authentication.

Implemented End-points: login,register

Install

$ npm install
$ npm run start-auth

Might need to run

npm audit fix

How to login/register?

You can login/register by sending a POST request to

POST http://localhost:8000/auth/login
POST http://localhost:8000/auth/register

with the following data

{
  "email": "admin@email.com",
  "password":"admin"
}

You should receive an access token with the following format

{
   "access_token": "<ACCESS_TOKEN>"
}

You should send this authorization as Header with any request to the protected endpoints

Authorization: Bearer <ACCESS_TOKEN>

Protected Endpoints

POST http://localhost:8000/locations
POST http://localhost:8000/products
POST http://localhost:8000/families
POST http://localhost:8000/transactions

About

Just a mock api for testing auth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%