jwt token equivalent between nodeJs and Symfony

jwt token equivalent between nodeJs and Symfony

I have the code generate in Symfony 3, such as:

$hashData = [
  'user_id' => 10,
  'exp' => time() + (3600)
];

Encoded with:

$hash = $container->get('lexik_jwt_authentication.encoder')->encode($hashData);

But the jwt token is not the same as coded with nodeJs:

var jwt = require("jsonwebtoken");

const jwtData = {
  user_id: 10
};

const token = jwt.sign({ jwtData }, "passphrase", {
  expiresIn: "1 hour"
});

The node jwt token has a half length.. Any ideas ?

Source: Symfony Questions

Leave a Reply

Your email address will not be published. Required fields are marked *