Skip to content

Instantly share code, notes, and snippets.

@mbrown3321
Created October 10, 2020 04:10
Show Gist options
  • Save mbrown3321/5a503ce75101dd63c97bae9eaf77dc68 to your computer and use it in GitHub Desktop.
Save mbrown3321/5a503ce75101dd63c97bae9eaf77dc68 to your computer and use it in GitHub Desktop.
const checkScopes = permissions => jwtAuthz(permissions);
app.get('/users', checkScopes(['read:users']), (req, res) => {
res.json({ users: [{ id: 1 }, { id: 2 }] })
})
app.post('/user', checkScopes(['create:users']), (req, res) => {
res.sendStatus(201);
});
app.delete('/user', checkScopes(['delete:users']), (req, res) => {
res.sendStatus(200);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment