Last active
October 31, 2018 22:35
-
-
Save brunokrebs/74e4b693e4d76898948228c31e739c39 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
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