Skip to content

Claim asString returns null for types with valid string representations #614

@worthc21

Description

@worthc21

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions