AuthenticService
This is the service component of authentic. This will help decode tokens so that you can authenticate users within a microservice.
Example
var http = var Authentic = var auth = http console
Installation
npm install --save authentic-service
API
Authentic(opts)
This is the main entry point. Accepts an options object and returns a function that can parse and decrypt tokens from http requests.
var auth = // auth is now a function that accepts req, res, and a callback
options
Authentic()
takes an options object as its first argument, one of them is required:
server
: the url of theauthentic-server
, e.g.'http://auth.yourdomain.com'
Optional:
prefix
: defaults to'/auth'
if you set a custom prefix for yourauthentic-server
, use that same prefix herecacheDuration
: defaults to3600000
(1 hour in milliseconds). To minimize latency and requests, this is how longauthentic-service
will cache theauthentic-server
public key.
License
MIT