Options
All
  • Public
  • Public/Protected
  • All
Menu

Class to verify the token.

Since it is agnostic to the framework, it needs to be called within a middleware.

Example:

function AuthMiddleware(req, res, next) {
// Get token previously with getToken function
const verifier = new JwtVerifier({
jwksUri: 'http://issuer.example.com/well-known/jwks.json',
issuer: 'http://issuer.example.com',
audience: 'https://myapi.com'
}));

const decoded = await verifier.verify(token);
// Store the decoded token in your req or context depending of the framework
req.auth = { token, decoded };
}

If IJwtVerifierOptions.tokenSigningAlg is not provieded by default is 'RS256'

Hierarchy

  • JwtVerifier

Index

Constructors

Methods

Constructors

Methods