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

Encode output with extra quote #469

Closed
vincentlkl opened this issue Feb 11, 2022 · 2 comments
Closed

Encode output with extra quote #469

vincentlkl opened this issue Feb 11, 2022 · 2 comments

Comments

@vincentlkl
Copy link

vincentlkl commented Feb 11, 2022

payload = "test"
token = JWT.encode payload, rsa_private_key, 'RS256'

when I paste the token to
https://dinochiesa.github.io/jwt/
I am getting
"test"

It cannot decode it to as a raw text
test
** without the double quote

@vincentlkl vincentlkl changed the title Encode output as extra quote Encode output with extra quote Feb 11, 2022
@anakinj
Copy link
Member

anakinj commented Feb 11, 2022

The behaviour you are seeing is in line with the JWT RFC. The payload is required to be a "valid JSON object", in this case it's a JSON string.

If you want to have custom behaviours when it comes to encoding and decoding there is something in the making in #460. But until that is finished the payload given will always be represented as a JSON object.

@vincentlkl
Copy link
Author

Thanks @anakinj looking forward to that.

I will close this issue as there is a WIP Pr #460

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