I'm trying to decode the JWT in node server [npm install jsonwebtoken] which is created in java [io.jsonwebtoken / jjwt / 0.6.0] but getting invalid signature error.
Does anyone had experienced the same and found the solution then could you please share with the group.
jwtToken = Jwts.builder().setSubject(email).claim("roles", "user").setIssuedAt(new Date(currentTimeInMills)).setExpiration(new Date(expireIn)) .signWith(SignatureAlgorithm.HS256,"secretKey").compact();
var jwt = require('jsonwebtoken'); var decoded = jwt.verify(jwtToken, "secretKey");
Is your node code defaulting to HS256 for the SignatureAlgorithm?
The error is quite clear and JWT is famously cross-platform compatible.
Verify the keys are identical on both sides, the claim objects are identical on both sides, and that the signature algorithms used are identical on both sides.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.