Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when decoding a JWT with an invalid JSON payload #134

Closed
santiagoaguiar opened this issue Sep 5, 2016 · 1 comment
Closed

Comments

@santiagoaguiar
Copy link

Given auth0/node-jws#23 , when passing an invalid JWT like:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.yJ1c2VybmFtZSI6InNhZ3VpYXIiLCJpYXQiOjE0NzEwMTg2MzUsImV4cCI6MTQ3MzYxMDYzNX0.foo

This line:
https://github.com/auth0/express-jwt/blob/master/lib/index.js#L86

Throws an exception, which can't be handled as described on the doc by using err.name === 'UnauthorizedError' as given on the docs. I understand the (imo) bug is actually on jws, but maybe it's possible to try/catch decode and handle it as a token that failed verification.

@jfromaniello
Copy link
Member

Fixed in v5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants