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

Incorrectly rejects whitespace after JSON header as invalid #144

Closed
timmc opened this issue Mar 2, 2017 · 1 comment
Closed

Incorrectly rejects whitespace after JSON header as invalid #144

timmc opened this issue Mar 2, 2017 · 1 comment
Milestone

Comments

@timmc
Copy link

timmc commented Mar 2, 2017

If I create a JWT with whitespace after the header JSON's closing brace, the library rejects the token with a decode exception.

Example token: eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9Cg.e30K.MEYCIQD9xmk9EtRLX7EwfgaWUc8ioyFcwvfQ1lIy9dANOuLBCwIhALyQ42E8W3et8FGBWfUxtEgfucLA0V47gJlenA5Us_IL

Exception:

#<JWTDecodeException com.auth0.jwt.exceptions.JWTDecodeException: The string '{"typ":"JWT","alg":"ES256"}
' doesn't have a valid JSON format.>

RFC 7519 says the JSON under the base64 is allowed to have whitespace between and around JSON elements. In this case, there's a trailing 0x0A.

@timmc
Copy link
Author

timmc commented Mar 14, 2017

Thanks! :-D

@lbalmaceda lbalmaceda added this to the v3-Next milestone Apr 26, 2017
@lbalmaceda lbalmaceda modified the milestones: v3-Next, 3.2.0 May 4, 2017
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

No branches or pull requests

2 participants