Message seems corrupt or manipulated

I was trying to embed the metabase questions into my webpage.
followed this link

Tried to create the token in javascript, Able to create the token. but the url is not working

please follow GitHub - metabase/embedding-reference-apps: Reference applications for common web frameworks showing how to embed Metabase charts

This is what i have been trying - FYI

var jwt = KJUR.jws.JWS
var URL = Url;
var key = secretkey
var payload = {
resource: { question: '302' },
};
var token = jwt.sign("HS256", '{alg: "HS256", typ: "JWT"}', payload, key);
var url = URL + "/embed/question/" + token + "#bordered=true&titled=true";

My application was not running in node.js, i tried the same example with javascript

It works