You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should jwsDecode return null if payload is not valid JSON? #23
Seems it might be for this particular case, given we're trying to parse json within the library.
Seems to me like we shouldn't be attempting to parse json at all though really, better off sending along the utf8 (or otherwise encoded) string and let the consumer/jwt library deal with that.
Given the current behavior where other malformed cases (invalid header, invalid jws) are already returned as null, it seems using safeJsonParse should be the right way to do it.
Given this was raised more than a year ago, my hopes aren't high :).
Activity
dschenkelman commentedon Jun 2, 2015
It was just a bit of code, I went ahead and created the PR: #24
omsmith commentedon Jul 19, 2015
Seems it might be for this particular case, given we're trying to parse json within the library.
Seems to me like we shouldn't be attempting to parse json at all though really, better off sending along the utf8 (or otherwise encoded) string and let the consumer/jwt library deal with that.
Would be a breaking change. Thoughts?
santiagoaguiar commentedon Sep 5, 2016
The header is already checked using
safeJsonParseat:https://github.com/brianloveswords/node-jws/blob/master/lib/verify-stream.js#L23
Given the current behavior where other malformed cases (invalid header, invalid jws) are already returned as
null, it seems usingsafeJsonParseshould be the right way to do it.Given this was raised more than a year ago, my hopes aren't high :).