auth0 / java-jwt

Java implementation of JSON Web Token (JWT)
MIT License
5.84k stars 921 forks source link

IncorrectClaimException #684

Closed Richyeoh closed 4 months ago

Richyeoh commented 4 months ago

Checklist

Description

fun encode(iat: Long, exp: Long, uid: String): String {
    val build = JWT.create()
    build.withClaim("uid", uid)
    build.withExpiresAt(Date(System.currentTimeMillis() + EXPIRES_TIME))
    return build.sign(Algorithm.HMAC256(SECRET))
}

fun decode(token: String): DecodedJWT {
    return JWT.require(Algorithm.HMAC256(SECRET)).build().verify(token)
}

Here is my kotlin code, When I using decode fun throw an exception IncorrectClaimException

Reproduction

I using decode fun throw an exception IncorrectClaimException

Additional context

No response

java-jwt version

4.4.0

Java version

17