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's token.
Debugging.
When logged 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
Whendebugginginjwtclasses,itgiveserrorinthislineintheDefaultJwtSignatureValidatormethod:
Thenjwthasaclassandmethodstoadjustandvalidatethetoken.
Theproblemisthatitisstoppinginthismethodonthisline:
@OverridepublicbooleanisValid(StringjwtWithoutSignature,Stringbase64UrlEncodedSignature){byte[]data=jwtWithoutSignature.getBytes(US_ASCII);byte[]signature=TextCodec.BASE64URL.decode(base64UrlEncodedSignature);returnthis.signatureValidator.isValid(data,signature);}
ThedataandsignatureValidatorvariablesaredifferent.
Images:
ThevariablejwtWithoutSignature,whicharrivesinthejwtmethod,isnotthegeneratedtoken,onlyapart.
Validationerror link