# jwt-auth-service

> A service which does oauth authentication and issues a JWT token.

Latest version **1.0.0** (published 2019-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install jwt-auth-service
pnpm add jwt-auth-service
yarn add jwt-auth-service
bun add jwt-auth-service
```

Provides the command `jwt-auth-service`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-06-08 |
| First published | 2019-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 19 |
| Unpacked size | 173.9 KB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| Author | Jeswin Kumar |
| Maintainers | jeswin |

## Links

- npm: https://www.npmjs.com/package/jwt-auth-service
- npm.io page: https://npm.io/package/jwt-auth-service

## Dependencies (19)

- [pg](https://npm.io/package/pg.md) ^7.11.0
- [koa](https://npm.io/package/koa.md) ^2.7.0
- [request](https://npm.io/package/request.md) ^2.88.0
- [@types/pg](https://npm.io/package/@types/pg.md) ^7.4.14
- [grant-koa](https://npm.io/package/grant-koa.md) ^4.5.0
- [koa-mount](https://npm.io/package/koa-mount.md) ^4.0.0
- [@types/koa](https://npm.io/package/@types/koa.md) ^2.0.48
- [koa-router](https://npm.io/package/koa-router.md) ^7.4.0
- [@types/node](https://npm.io/package/@types/node.md) ^10.9.2
- [koa-session](https://npm.io/package/koa-session.md) ^5.10.1
- [psychopiggy](https://npm.io/package/psychopiggy.md) ^1.0.3
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1
- [@types/request](https://npm.io/package/@types/request.md) ^2.48.1
- [koa-bodyparser](https://npm.io/package/koa-bodyparser.md) ^4.2.1
- [@types/koa-mount](https://npm.io/package/@types/koa-mount.md) ^3.0.1
- [@types/koa-router](https://npm.io/package/@types/koa-router.md) ^7.0.40
- [@types/koa-session](https://npm.io/package/@types/koa-session.md) ^5.10.0
- [@types/jsonwebtoken](https://npm.io/package/@types/jsonwebtoken.md) ^8.3.2
- [@types/koa-bodyparser](https://npm.io/package/@types/koa-bodyparser.md) ^4.3.0

## Recent versions

- 1.0.0 (latest) — 2019-06-08
- 0.0.12 — 2019-06-07
- 0.0.11 — 2019-05-21
- 0.0.10 — 2019-05-20
- 0.0.9 — 2019-05-20
- 0.0.8 — 2019-05-14
- 0.0.7 — 2019-05-12
- 0.0.6 — 2019-05-11
- 0.0.5 — 2019-05-11
- 0.0.4 — 2019-05-11
- 0.0.3 — 2019-05-11

## README

# jwt-auth-service

A service which does oauth authentication and issues a JWT token.

## Installation

1. Install via npm.

```sh
npm i -g jwt-auth-service
```

2. Create a postgres database and create the tables with scripts found under the 'db' directory.

## Running

You'd use something like this.

```sh
(export PORT=5999 CONFIG_DIR=/some/path/to/config DOMAIN=example.com; jwt-auth-service)
```

Where:

- PORT is the port on which the service will run.
- CONFIG_DIR is the directory in which config files are placed.
- DOMAIN is your application's main domain.

An example directory containing config files (which are JS files) can be found under the 'example-config' directory. This is where you specify database connection strings, jwt signing keys etc.

## Authenticating

Send the browser to YOUR_DOMAIN/authenticate/OAUTH_SERVICE?redirect=SOME_URL. For example: www.example.com/authenticate/github?redirect=docs.example.com. The page will redirect to docs.example.com after authentication with the 'jwt-auth-service-jwt' cookie set to the JWT token.

---
_Source: https://npm.io/package/jwt-auth-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
