JWT tokenization is driving me crazy or I am using it wrong.
To test out and start with "jjwt", i am creating a simple jwt token, below is the code.
static String createSimpleJWT() {
String id, issuer, subject;
id="id";
issuer="issuer";
subject="subject";
//Let's set the JWT Claims
JwtBuilder builder = Jwts.builder().setId(id)
.setSubject(subject)
.setIssuer(issuer)
.signWith(SignatureAlgorithm.HS256, "signingKey"); //plz note signing key on this line
return builder.compact();
}
The jwt token is
eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJpZCIsInN1YiI6InN1YmplY3QiLCJpc3MiOiJpc3N1ZXIifQ._7QGamE-HvREDMJIgbfKEIRv76ZaxwIx2t3RaViSYzth4
As intended, on subsequent executions also I get the same JWT.
eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJpZCIsInN1YiI6InN1YmplY3QiLCJpc3MiOiJpc3N1ZXIifQ._7QGE-HvREDMJIgbfKEIRv76ZaxwIx2t3RaViSYzth4
I am decoding it using jwt.io to test - but am suprised to see that the jwt token is flaged with Invalid Signature inspite of providing the correct signing key in the decode section.
Here is jwt.io screenshot - jwt.io-invalidsignature
Any pointers... where it's getting messed.
This post is different from what's asked earlier where the users forgot or were not aware about providing signing key to jwt.io
PHP JWT Token Invalid Signature
JWT Token Invalid Signature