Documentation and support for Java-JWT library

The java-jwt library is officially supported by Auth0 and it will continue to be supported. It’s under the MIT license, so it can be used free of charge. The documentation of the library can be found in the README of the github repository and in javadoc.

When you use JWTVerificationException, each individual exception is triggered depending on the situation, as can be seen here. So you could use this as described in the README

try {
    Algorithm algorithm = Algorithm.RSA256(publicKey, privateKey);
    JWTVerifier verifier = JWT.require(algorithm)
        .withIssuer("auth0")
        .build(); //Reusable verifier instance
    DecodedJWT jwt = verifier.verify(token);
} catch (JWTVerificationException exception){
    //Invalid signature/claims
}
1 Like