Skip to content

A login service built on top of hharnisc/auth and hharnisch/user services.

License

Notifications You must be signed in to change notification settings

hharnisc/login-service

Repository files navigation

Login

Build Status

A login service, built on top of hharnisc/auth and hharnisc/user.

NOTE: this is a work in progress

Table Of Contents

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

User Object

{
  "id": "1",
  "email": "someone@xyz.com",
  "emails": ["someoneelse@xyz.com", "someone@xyz.com"],
  "providers": {
    "google": {
      /* google provider data*/
    }
  },
  "roles": ["read", "write", "sudo"]
}

Auth Token

{
  "accessToken": "some.access.token",
  "refreshToken": "some.refreshToken",
  "expireTime": 1465994137309
}

API

GET /health

A health check

request

No parameters

response

200 - Empty

GET /v1/login

Login a user. Creates or updates a user (keyed off of email address) and returns the full user object with a session token to make requests against internal apis.

request

  • email - email address* - the user's email address
  • provider - string - the source where the user was authenticated
  • providerInfo - object - any metadata to store from the source
  • roles - [string] - a list of roles associated with the user

Note roles are only set on the first time the user is seen

response

GET /v1/logout

Logout a user. Rejects the refresh token for a user so it can't be used to create new access tokens.

request

  • userId - email address* - user id
  • refreshToken - string - persistent token used to generate an accessToken

response

200 - Empty

About

A login service built on top of hharnisc/auth and hharnisch/user services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published