SignatureException while parsing correctly signed JJWT token retrieved from X-AUTH-TOKEN header of client request in Jersey request filter

I am trying to parse claims in a JJWT token that I retreive from X-AUTH-TOKEN header of a client request. The matter is that the parsing throws SignatureException, though the token is correctly signed.

Here is my Jersey filter :

public class ClientClaimsFilter implements ContainerRequestFilter {

    public void filter(ContainerRequestContext requestContext) throws IOException {
        String token = requestContext.getHeaderString("X-AUTH-TOKEN");
        if ((token != null) && (!token.isEmpty())) {
            Claims claims = Jwts.parse().setSigningKey(key).parseClaimsJws(token).getBody();

Where key was generated like this String key = TextCodec.BASE64.encode(MacProvider.generateKey(SignatureAlgorithm.HS256).getEncoded()); I verified that the key stays the same while generating token and while parsing it. But there is still SignatureException with the parsing.