Skip to content

Instantly share code, notes, and snippets.

@brunokrebs
Last active October 31, 2018 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunokrebs/74e4b693e4d76898948228c31e739c39 to your computer and use it in GitHub Desktop.
Save brunokrebs/74e4b693e4d76898948228c31e739c39 to your computer and use it in GitHub Desktop.
var express = require('express');
var bodyParser = require('body-parser');
const jwt = require('express-jwt');
const jwksRsa = require('jwks-rsa');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
const jwtCheck = jwt({
secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksUri: `https://idee.auth0.com/.well-known/jwks.json`
}),
// Validate the audience and the issuer.
audience: 'https://slack-clone/',
issuer: `https://idee.auth0.com/`,
algorithms: ['RS256']
});
// Fetch all users in ChatKit instance
app.get('/users', jwtCheck, (req, res) => {
res.status(200).send([]);
});
app.listen(3001, () => {
console.log('listening on port 3001');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment