Hello. I've found in your documentation:
require 'jwt'
payload = {:data => 'test'}
# IMPORTANT: set nil as password parameter
token = JWT.encode payload, nil, 'none', { :typ => "JWT" }
But what happens when we want to add custom headers using a password?
I'm trying to generate a JWT for a chat service called Smooch. Here's their docs.
They have an example in node.js server, and I've found this gem is quite popular for rails server to generate those. I tried this:
def smooch_jwt
payload = {
scope: 'appUser',
userId: smooch_user_id
}
header_fields = {
alg: 'HS256',
typ: 'JWT',
key: ENV['SMOOCH_KEY_ID']
}
JWT.encode payload, ENV['SMOOCH_SECRET'], 'HS256', header_fields
end
And it seems to generate a JWT but It can be decoded w/out using the ENV['SMOOCH_SECRET']. Isn't that password supposed to be needed to decode it? That JWT is not being accepted by their API and I don't know if I'm misunderstanding them or you.
I'm very confused about it.
Hello. I've found in your documentation:
But what happens when we want to add custom headers using a password?
I'm trying to generate a JWT for a chat service called Smooch. Here's their docs.
They have an example in node.js server, and I've found this gem is quite popular for rails server to generate those. I tried this:
And it seems to generate a JWT but It can be decoded w/out using the
ENV['SMOOCH_SECRET']. Isn't that password supposed to be needed to decode it? That JWT is not being accepted by their API and I don't know if I'm misunderstanding them or you.I'm very confused about it.