I had some problems handling this library concerning insert an array into JWT.encode, suposing I have a JSON in array format. Testing on padrino IRB, I got this error:
TypeError: no implicit conversion of String into Integer
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jwt-1.5.6/lib/jwt.rb:88:in []'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jwt-1.5.6/lib/jwt.rb:88:in encoded_payload'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jwt-1.5.6/lib/jwt.rb:105:in encode'
from (irb):12
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/padrino-core-0.13.3.3/lib/padrino-core/cli/base.rb:43:in console'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in invoke_command'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in start'
from /home/alan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/padrino-core-0.13.3.3/bin/padrino:9:in <top (required)>'
from /home/alan/Documentos/git/phschool/backend/api/bin/padrino:17:in load'
from /home/alan/Documentos/git/phschool/backend/api/bin/padrino:17:in <main>'
I have tested the command jwt = JWT.encode([{"id"=>1}],'!chave','HS256') an it raised. What is the best way to handle this error? In the official web page of JWT is possible to convert directly from JSON array to JWT, so why I can't deal with this gem just like that?
I had some problems handling this library concerning insert an array into
JWT.encode, suposing I have a JSON in array format. Testing on padrino IRB, I got this error:I have tested the command
jwt = JWT.encode([{"id"=>1}],'!chave','HS256')an it raised. What is the best way to handle this error? In the official web page of JWT is possible to convert directly from JSON array to JWT, so why I can't deal with this gem just like that?