You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getClaim("X").asX returns null for values that have valid toString representations
When creating a private claim with an integer value - withClaim("ID", 1234)
the decoded JWT getClaim("ID").asString()
returns null
When creating a private claim with a boolean value - withClaim("flag", true)
the decoded JWT getClaim("flag").asString()
returns null
What was the expected behavior?
An integer value would return the string representation of the value (just as Integer.toString() does)
A boolean value would return the string representation of the value (just as Boolean.toString() does)
Versions
java-jwt: 4.0.0
java - JDK 11
spring boot - 2.7.4
The text was updated successfully, but these errors were encountered:
Thanks for raising @worthc21. Yes, that is the expected behavior, as we first check that the node is textual. For the string value, you can use toString(). Hope that helps!
I did not find this to be a good idea. Why can't we have the claim just as a string instead we get the null? The programmer decides to have it as a raw string or not. Instead, the library forces it to parse as .asObject(PoJo::class.java).
Describe the problem
getClaim("X").asX returns null for values that have valid toString representations
When creating a private claim with an integer value -
withClaim("ID", 1234)
the decoded JWT
getClaim("ID").asString()
returns null
When creating a private claim with a boolean value -
withClaim("flag", true)
the decoded JWT
getClaim("flag").asString()
returns null
What was the expected behavior?
An integer value would return the string representation of the value (just as Integer.toString() does)
A boolean value would return the string representation of the value (just as Boolean.toString() does)
Versions
java-jwt: 4.0.0
java - JDK 11
spring boot - 2.7.4
The text was updated successfully, but these errors were encountered: