--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/cfd00185-38d4-4443-accd-275b9d180ccc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/f86f1fd9-d6a0-4974-bbbd-fec47658f5b4%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7f53e803-d73e-4b7f-94f7-b59b8b79e43a%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/65478513-fdbf-4767-b098-6c1498b72f13%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/1889fefe-bd56-415c-ac95-a2bed053b5fb%40googlegroups.com.
require 'jwt' # uses version 1.5.4
public_keys = { ...Hash of the public keys from the googleapis link... }
token = ".... JWT token ...."
puts JWT.decode(token, public_keys["correct key value"], true, { algorithm: "RS256", verify_iat: true }) # you can try other verification options, it doesn't matter
/Users/hm/.rvm/gems/ruby-2.3.0@blah/gems/jwt-1.5.4/lib/jwt.rb:49:in `verify_rsa': undefined method `verify' for #<String:0x007feee39cf3e0> (NoMethodError)
from /Users/hm/.rvm/gems/ruby-2.3.0@blah/gems/jwt-1.5.4/lib/jwt.rb:139:in `verify_signature'
from /Users/hm/.rvm/gems/ruby-2.3.0@blah/gems/jwt-1.5.4/lib/jwt.rb:124:in `decode'
from jwt_token.rb:40:in `<main>'
You are correct that the value for rsa_public should be the full public key string ("-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n") corresponding to the JWT's kid from the URL you posted. If that is not working, please post some code showing what you are trying as well as the error message you are receiving. Without those things, we can only guess at what your problem is.Jacob
On Wed, Aug 3, 2016 at 3:03 PM, Hiren Mistry <hi...@joinloop.com> wrote:
Jacob,Got it.What's tripping me is what to put for rsa_public so ruby-jwt will run verification?JWT.decode(token, rsa_public, true, { :algorithm => 'RS256' })
Based on my understanding from the docs, I tried the public keys (and corresponding key) from https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com.
Jacob,Thank you for your patience in helping me understand the pieces correctly.Here's what I'm trying out... very simple.The error is in the JWT library where it tries to pass a method `verify` to the string I passed as `rsa_public`. I looked through the JWT doc's but there's not mention `rsa_public` should be of some type so I assume its a string based on example.If I set verification to false, JWT.decode will decode the token and I can see the contents. But I need verification to work so I know its legit.Hiren.require 'jwt' # uses version 1.5.4
public_keys = { ...Hash of the public keys from the googleapis link... }
token = ".... JWT token ...."
puts JWT.decode(token, public_keys["correct key value"], true, { algorithm: "RS256", verify_iat: true }) # you can try other verification options, it doesn't matterError I get is:/Users/hm/.rvm/gems/ruby-2.3.0@blah/gems/jwt-1.5.4/lib/jwt.rb:49:in `verify_rsa': undefined method `verify' for #<String:0x007feee39cf3e0> (NoMethodError)
from /Users/hm/.rvm/gems/ruby-2.3.0@blah/gems/jwt-1.5.4/lib/jwt.rb:139:in `verify_signature'
from /Users/hm/.rvm/gems/ruby-2.3.0@blah/gems/jwt-1.5.4/lib/jwt.rb:124:in `decode'
from jwt_token.rb:40:in `<main>'
On Wednesday, August 3, 2016 at 3:34:15 PM UTC-7, Jacob Wenger wrote:
You are correct that the value for rsa_public should be the full public key string ("-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n") corresponding to the JWT's kid from the URL you posted. If that is not working, please post some code showing what you are trying as well as the error message you are receiving. Without those things, we can only guess at what your problem is.Jacob
On Wed, Aug 3, 2016 at 3:03 PM, Hiren Mistry <hi...@joinloop.com> wrote:
Jacob,Got it.What's tripping me is what to put for rsa_public so ruby-jwt will run verification?JWT.decode(token, rsa_public, true, { :algorithm => 'RS256' })
Based on my understanding from the docs, I tried the public keys (and corresponding key) from https://www.googleapis.com/robot/v1/metadata/x509/secureto...@system.gserviceaccount.com.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2a14d851-873b-4df1-9f33-532e7818537b%40googlegroups.com.
Hey Hiren,
Based on my understanding from the docs, I tried the public keys (and corresponding key) from https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com.
certificates = { ...Hash of the public certificates from the googleapis link... }
x509 = OpenSSL::X509::Certificate.new(certificates["correct key value"])
JWT.decode(token, x509.public_key, true, { algorithm: "RS256", verify_iat: true }) # call whatever verification you wish to check for
Based on my understanding from the docs, I tried the public keys (and corresponding key) from https://www.googleapis.com/robot/v1/metadata/x509/secureto...@system.gserviceaccount.com.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c3083df6-e95f-49b5-a791-b93eb6472b98%40googlegroups.com.