plug-auth-server

1.1.2 • Public • Published

plug-auth-server

Installation

npm install --save plug-auth-server

Usage

See the example app for a more in-depth example.

import * as fs from 'fs'
import express from 'express'
import {
  authenticator,
  authRoute
} from 'plug-auth-server'
 
const secret = fs.readFileSync('./secret.dat')
 
const engine = authenticator({
  auth: userAccount,
  secret: secret
})
 
const app = express()
app.use('/plug-auth', authRoute(engine))

API

authenticator(options: object)

Options:

  • auth: Login details for a plug.dj account. This account will be used for the requests needed to verify a plug.dj user.

    • auth.email: Email address.
    • auth.password: Password.
  • secret: Key used to sign authentication tokens.

  • users: Optional - a user repository instance.

authRoute(authenticator: object)

Create an express/koa-style route handler for the authentication endpoint. Works well together with plug-auth-client's httpTransport.

import { authenticator, authRoute } from 'plug-auth-server'
const engine = authenticator({ ...options })
const app = express()
app.use('/plug-auth', authRoute(engine))

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.2
    1
  • 1.1.1
    0
  • 1.1.0
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i plug-auth-server

Weekly Downloads

1

Version

1.1.2

License

MIT

Last publish

Collaborators

  • goto-bus-stop