DecodedJWT verifier = null;
try {
Algorithm algorithm = Algorithm.HMAC256(apiSecret); // validando firma
verifier = JWT.require(algorithm)
.withIssuer("voll med")
.build()
.verify(token);
verifier.getSubject();
} catch (JWTVerificationException exception) {
System.out.println(exception.toString());
}
if (verifier.getSubject() == null) {
throw new RuntimeException("Verifier invalido");
}
return verifier.getSubject();
}
Me lanza un error del tipo:
java.lang.NullPointerException: Cannot invoke "com.auth0.jwt.interfaces.DecodedJWT.getSubject()" because "verifier" is null
Alguna sugerencia?