(Work In Progress)
A library to provide keys for JWT verification.
npm install --save jwt-keysource
var signingKeyUrls = [
'https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com',
'https://www.googleapis.com/oauth2/v1/certs'
];
/*
* For inclusion in middleware:
*
* Is a function taking arguments (req, header, payload, cb)
*/
var signingKeyProvider = require('jwt-keysource').buildKeyProvider(signingKeyUrls);
/*
* Raw key source:
* Exposes 'getVerificationKeys()' which returns a promise of keys JSON.
*/
var UriKeySource = require('jwt-keysource').UriKeySource;
var myKeySource = new UriKeySource(/* URI to JSON of keys mapped by key ID*/)
To show trace logs you can set the following environment variable:
DEBUG=jwt-keysource
ISC
- Inspired by auth0's jwks-rsa library