- Redis https://redis.io/download
- Node.js https://nodejs.org/en/download
npm i
- install packages
redis-server
- run redis server
npm run start
- run node.js server
docker-compose up
- aggregates the output of each docker container
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" |
- 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