Hey. Due to the table header not being ordered, I get two different tokens (randomly). Both are correct, but it is unacceptable in many cases to not have only one token.
local function generateToken(payload)
local token = jwt:sign(secret, {
header = { typ = "JWT", alg = "HS512" },
payload = payload,
exp = ngx.time() + tokenExp
})
return token
end
The issue is that the header table might end up being { typ = "JWT", alg = "HS512" } and at other times { alg = "HS512", typ = "JWT" }, and thus resulting in a completely different token.
Do any of you know if there is a workaround for it?
Hey. Due to the table
header
not being ordered, I get two different tokens (randomly). Both are correct, but it is unacceptable in many cases to not have only one token.The issue is that the
header
table might end up being{ typ = "JWT", alg = "HS512" }
and at other times{ alg = "HS512", typ = "JWT" }
, and thus resulting in a completely different token.Do any of you know if there is a workaround for it?