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

Cryptic error messages if validation failed #297

Open
aschekatihin opened this issue Feb 7, 2019 · 6 comments
Open

Cryptic error messages if validation failed #297

aschekatihin opened this issue Feb 7, 2019 · 6 comments

Comments

@aschekatihin
Copy link

One of the past issues still valid: #227
There is no way to understand what's wrong with your setup except trial and error or debugging node_modules. If something is wrong all you get is invalid token and that's it.

image

It seems like verify_err could be passed to errorContext and handled at errorFunc to log real problem to server log while returning generic error for users.

@nelsonic
Copy link
Member

nelsonic commented Feb 7, 2019

@aschekatihin it's very difficult for us to debug this error without more detail.
Are you able to share a bit more of you code than a screenshot?
(you can temporarily add me to private repo if you like so I can help you debug it...)

@aschekatihin
Copy link
Author

It is easy to reproduce, just use incorrect audience, issuer or algorithm in verifyOptions to make it fail.
Sorry, can't add you to private repo.
But I can share a pull request that contains changes I did locally to have detailed log for almost every call of raiseError:
image

by using existing errorFunc:
image

@nelsonic
Copy link
Member

nelsonic commented Feb 7, 2019

@aschekatihin sorry, I don't follow. Are you submitting a valid JWT (token) but with invalid/incorrect verifyOptions ?

@aschekatihin
Copy link
Author

@nelsonic , either valid JWT and invalid verifyOptions or vice versa. In both cases there will be invalid token error with no details. Specifying incorrect verifyOptions is just easy way to test it.

@aschekatihin
Copy link
Author

Invalid verifyOptions is a synthetic way to simulate real problem, not sure what's confusing about it. If you settings up custom OpenId server like keykloak it could be misconfigured in several areas and without detailed error it is not so easy to find what excatly is wrong. jsonwebtoken 's verify() provides these details, they are just hidden for some unknown reason

@aschekatihin
Copy link
Author

#298

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

No branches or pull requests

2 participants