The Wayback Machine - https://web.archive.org/web/20220309174923/https://github.com/jwt/ruby-jwt/issues/246
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

JSON support #246

Closed
msroot opened this issue Oct 31, 2017 · 3 comments
Closed

JSON support #246

msroot opened this issue Oct 31, 2017 · 3 comments

Comments

@msroot
Copy link

@msroot msroot commented Oct 31, 2017

I dint see anywhere in the ready me about Json Support
So is it official Json data supported?

data = {foo: 'bar'}
exp_payload = { :data => data, :exp => 1.month.from_now.to_i }
hmac_secret = "yo"

token = JWT.encode exp_payload, hmac_secret, 'HS256'
# => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImZvbyI6ImJhciJ9LCJleHAiOjE1MTIwNzQ4Njl9.b7vPoy6oU4W0x0qtcMm0cDjg3uMOFBY5mbL1Bj0BkeQ"


JWT.decode token, hmac_secret, true, { :algorithm => 'HS256' }
# => [{"data"=>{"foo"=>"bar"}, "exp"=>1512074869}, {"typ"=>"JWT", "alg"=>"HS256"}]
@mod
Copy link

@mod mod commented Mar 17, 2018

I am also looking for the implementation of
https://tools.ietf.org/html/rfc7515#section-7.2.1

General JWS JSON Serialization Syntax
with multiple signature support

@ab320012
Copy link
Contributor

@ab320012 ab320012 commented Apr 11, 2018

@excpt @msroot you can already encode/decode ruby hash like the example code, not sure that there is anything to be done

@msroot
Copy link
Author

@msroot msroot commented Apr 19, 2018

@ab320012 Sure we can close the issue then. I just dint see it in read me anywhere

@msroot msroot closed this Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants