this is the error I am facing in here
public boolean validateToken(String jwt){
Jwts.parser().setSigningKey(key).parseClaimsJws(jwt);
return true;
}
this is the error I am facing in here
public boolean validateToken(String jwt){
Jwts.parser().setSigningKey(key).parseClaimsJws(jwt);
return true;
}
Take a look at this documentation. You might want to do something like this.
Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(jwt);
Charles answer solves one problem, but there are two deprecated methods here: parser() and setSigningKey(). In order to avoid both deprecations, the following code is required:
SecretKey secret = Keys.hmacShaKeyFor(Decoders.BASE64.decode(key));
Jwts.parserBuilder().setSigningKey(secret).build().parseClaimsJws(jwt);
You can read more about this at https://github.com/jwtk/jjwt#jws-create-key