node-lanetix-make-token
Module to simplify interating with the auth service to get a token. Up to ~150MB of tokens are cached for slightly less than the time they take to expire (one day), at which point the least recently used are removed.
Installation
Ensure that you are are logged in as the lanetix npm user via npm login
or
use a .npmrc
file with a token for the lanetix user.
npm install --save @lanetix/make-token
Usage
To use this library,
var makeToken = require('@lanetix/make-token')(
'http://url.to.auth',
'private....key....',
'urn:issurer'
);
makeToken.forUser(1337)
.then(function (token) {
});
makeToken.forSystemUser(42)
.then(function (token) {
});
In order for auth to not 401, you'll need to register your service's public key
here.