plug-auth-server
Client- and server-side library for "authenticating" plug.dj users to your service. Sort of like third-party OAuth for plug.dj, but not OAuth.
Last updated 4 years ago by goto-bus-stop .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install plug-auth-server 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.2                                ...           latest (4 years ago)

4 Versions

  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (7)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |