Skip to content

Instantly share code, notes, and snippets.

@mbrown3321
Last active October 10, 2020 03:55
Show Gist options
  • Save mbrown3321/9f738e77e7ab04461c6f5d98745c8a31 to your computer and use it in GitHub Desktop.
Save mbrown3321/9f738e77e7ab04461c6f5d98745c8a31 to your computer and use it in GitHub Desktop.
const express = require('express');
const app = express();
const jwt = require('express-jwt');
const jwks = require('jwks-rsa');
const jwtAuthz = require('express-jwt-authz');
app.use(jwt({
secret: jwks.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 25,
jwksUri: 'https://dev-gkawf0h0.us.auth0.com/.well-known/jwks.json'
}),
audience: 'https://auth0-nodejs-example',
issuer: 'https://dev-gkawf0h0.us.auth0.com/',
algorithms: ['RS256']
}));
app.get('/secured', (req, res) => {
res.json({ success: true });
});
app.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment