auth0 / express-jwt

connect/express middleware that validates a JsonWebToken (JWT) and set the req.user with the attributes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom JWT validations

karlismelderis opened this issue · comments

Maybe it's already possible with current setup and I'm just reading README wrong 🤷‍♂️

Describe the problem you'd like to have solved

Cognito JWT tokens have property:

'cognito:groups': [ ... list of groups ...],

I would like to write extra validation function (instead of another middle-ware) to specify if user is member of group then ...

Describe the ideal solution

jwt({
validation: (decodedToken) => {
... so some validation and throw if needed ...
})

## Alternatives and current work-arounds

I would need to attach new middleware to validate decoded `.user`