Skip to content

Service that provides API for authentication, using Node.js and Redis

Notifications You must be signed in to change notification settings

kremeshnoi/auth-service

Repository files navigation

Auth Service

CircleCI Docker Automated build

       

Requirements

Optional

To run the project

Manually

npm i - install packages

redis-server - run redis server

npm run start - run node.js server

Docker

docker-compose up - aggregates the output of each docker container

API

Routes Methods Description Example Request
/api/v1/auth/register POST accepts username and password
username - should be a string
password - should be a string
{"username": "username",
"password": "nbiEx8Kl"}
/api/v1/auth/login POST after successfully signing in,
controller will generate refresh
and access tokens
{"username": "username",
"password": "nbiEx8Kl"}
/api/v1/auth/refresh GET accepts refresh token from
request headers, to generate
new refresh and access tokens
and deletes the old ones
"Refresh-Token", "token"
/api/v1/auth/sign-out GET accepts access token from
request headers, to delete that
access and it's associated
refresh token from database
"Access-Token", "token"

API notes

  • Each generated token has an expiration date. By default, the Access Token expires after 1 hour and the Refresh Token after 2 hours
  • Tokens generated by the controller in one request are associated to each other. Therefore, having an access token, we can erase the refresh token and vice versa

About

Service that provides API for authentication, using Node.js and Redis

Topics

Resources

Stars

Watchers

Forks