Skip to content

Instantly share code, notes, and snippets.

@rschwabco
Created December 16, 2021 21:11
Show Gist options
  • Save rschwabco/b0e5ab9e422ade8d01105bcdf8e7ae35 to your computer and use it in GitHub Desktop.
Save rschwabco/b0e5ab9e422ade8d01105bcdf8e7ae35 to your computer and use it in GitHub Desktop.
//Paste after the dependencies
const checkJwt = jwt({
// Dynamically provide a signing key based on the kid in the header and the signing keys provided by the JWKS endpoint
secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: process.env.JWKS_URI,
}),
// Validate the audience and the issuer
audience: process.env.AUDIENCE,
issuer: process.env.ISSUER,
algorithms: ["RS256"],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment