3
When trying to validate this method: Jws<Claims> parseClaimsJws = setSigningKey.parseClaimsJws(token);
, it shows this exception on the screen
JWT signature does not match locally computed signature.
JWT validity cannot be asserted and should not be trusted.
I need to validate the user token.
Threshing.
When logging in it generates this token: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIwMjY3OTUwMDYzNiIsImV4cCI6MTUyMjI3NjMxOX0.XBLiwl94He0ffVkf5TpcBKUob6PotuleSni5Hc9y8anPsES6WSO6f8Ki441UU_HGicyRAXmZKLBXsfQ2okFAqw
When he searches for a country he uses this token, Query made seconds later.
Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIwMjY3OTUwMDYzNiIsImV4cCI6MTUyMjI3NjMxOX0.
XBLiwl94He0ffVkf5TpcBKUob6PotuleSni5Hc9y8anPsES6WSO6f8Ki441UU_HGicyRAXmZKLBXsfQ2okFAqw
When debugging in jwt classes, it gives error in this line in method Defaultjwtsignaturevalidator:
Then jwt has a class and methods to adjust and validate the token.
The problem is he’s stopping this method on this line:
@Override
public boolean isValid(String jwtWithoutSignature, String base64UrlEncodedSignature) {
byte[] data = jwtWithoutSignature.getBytes(US_ASCII);
byte[] signature = TextCodec.BASE64URL.decode(base64UrlEncodedSignature);
return this.signatureValidator.isValid(data, signature);
}
The variables date and signatureValidator are different.
Imagery:
The variable jwtWithoutSignature, that arrives in the jwt method, it is not the generated token, only a part.
Error in site validation https://jwt.io/
I changed the description with a debug values where I think the problem is occurring.
– Guilherme
One more description after debugging more code.
– Guilherme