Extension Chat Message returns 401 authentication failed

This is the one right?

I am using this code to generate the Jwt to call the api but still getting the same error.

const sec = "secret from above image";
const secret = Buffer.from(sec, "base64");
app.post("/getJWTToken", (req, res) => {
  let data = {
    channel_id: 768266494,
    role: "external",
  };

  const token = jsonwebtoken.sign(data, secret);
  res.send(token);
});