- Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
I use https://github.com/jwtk/jjwt to encode and sign a token as follow:
Jwts.builder() .setSubject(authentication.getName()) .claim(AUTHORITIES_KEY, authorities) .signWith(SignatureAlgorithm.HS512, "my-secret-token-to-change-in-production") .setExpiration(validity) .compact();
then decode in node.js as follow:
var decoded = jwt.verify(req.get('Authorization'), 'my-secret-token-to-change-in-production', { algorithms: ['HS512'] });
and get the error:
JsonWebTokenError: invalid signature
Using jwt.decode
I get the token content without problem.
Am I doing something wrong?
darrenliuwei, joaowiciuk, jiangxiaoqiang, Aztaro97 and kratiknextsolutions