auth-service icon indicating copy to clipboard operation
auth-service copied to clipboard

A JWT token management service. Creates, refreshes and destroys authentication tokens.

Auth

Build Status

A token management service. It is responsible for creating, refreshing and destroying authentication tokens. Expirable/refreshable tokens are generated using JTW and can be passed onto the client.

Table Of Contents

  • Quickstart
  • Testing
  • Running Locally
  • Deploy Locally
  • Deploy To Production
  • API

Quickstart

Install docker beta

Do a local deploy

./local_deploy.sh

Testing

Install docker toolbox (for CI tests)

$ cd service

Install dependencies

$ npm install

CI Tests

$ npm run test

Run Unit Tests

$ npm run test:jest

Run Unit Tests (and watch for changes)

$ npm run test:watch

Run Integration Tests

$ npm run test:integration

Running Locally

$ cd service

Install dependencies

$ npm install

Start the server

$ npm start

Deploy Locally

Follow Quickstart instructions

Deploy Locally With Hot Reload

./local_deploy.sh -d

Deploy Locally And Skip Build Step

./local_deploy.sh -n

Deploy Locally With Hot Reload And Skip Build Step

./local_deploy.sh -dn

Deploy To Production

TODO

API

GET /health

A health check

request

No parameters

response

{}

POST /v1/create

Create a new auth token for a user

request

  • userId - string - an existing user id

response

  • accessToken - string - expirable token used to authenticate requests
  • refreshToken - string - persistent token used to generate an accessToken
  • expireTime - unix timestamp - the time the access token expires

POST /v1/refresh

Refresh an accessToken with the refreshToken

request

  • userId - string - an existing user id
  • refreshToken - string - persistent token used to generate an accessToken

response

  • accessToken - string - expirable token used to authenticate requests
  • expireTime - unix timestamp - the time the access token expires

POST /v1/reject

Delete a refreshToken so it cannot refresh an accessToken

request

  • userId - string - an existing user id
  • refreshToken - string - persistent token used to generate an accessToken

response

Empty