cti-passport-jwt-bearer-strategy
v1.0.3
Published
A Passport strategy for authenticating based on a bearer JWT header
Downloads
4
Maintainers
Readme
cti-passport-jwt-bearer-strategy
A Passport strategy for authenticating requests based on CTI bearer tokens and assigning relevant scopes.
Usage
const express = require( 'express' );
const passport = require( 'passport' );
const key = 'key';
const issuer = 'issuer';
const audience = 'audience';
const strategy = require( './../lib/jwtBearerStrategy' )(
key,
{ issuer: issuer, audience: audience }
);
passport.use( strategy );
const bearerAuthenticator =
passport.authenticate( strategy.name, { session: false } );
const app = express();
express.get( '/', bearerAuthenticator, ( req, res ) => {
res.send( 'You\'ve authenticated!' );
} );