Created
January 12, 2018 16:47
-
-
Save simonr-cb/65d35e6495c7ba170406bf69390357d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create middleware for checking the JWT | |
const checkJwt = jwt({ | |
// Dynamically provide a signing key based on the kid in the header and the singing keys provided by the JWKS endpoint | |
secret: jwksRsa.expressJwtSecret({ | |
cache: true, | |
rateLimit: true, | |
jwksRequestsPerMinute: 5, | |
jwksUri: "https://" + config.auth0Domain + "/.well-known/jwks.json" | |
}), | |
// Validate the audience and the issuer. | |
audience: process.env.AUTH0_AUDIENCE, | |
issuer: "https://" + config.auth0Domain + "/", | |
algorithms: ['RS256'] | |
}) | |
router.use(checkJwt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment