I am trying to Integrate Metabse embeded in React JS but It is throwing an error.
The errors are - from buffer, cryptography and couple of more errors.
import React, { Component } from "react";
import { sign } from "jsonwebtoken";
class Metabase extends Component {
render() {
const mbSiteUrl = "url";
const mbSecretKey =
"key";
const payload = {
resource: { dashboard: 1 },
exp: Math.round(Date.now() / 1000) + 10 * 60, //Expiration time in EPOCH
};
const token = sign(payload, mbSecretKey);
const iframeUrl = `${mbSiteUrl}/auth/sso?jwt=${token}&return_to=${encodeURIComponent(
mbSiteUrl
)}`;
return (
// <iframe
// src={iframeUrl}
// title="Metabase"
// style={{ border: "none", width: "100%", height: "100%" }}
// />
<iframe
src={iframeUrl}
// frameBorder={0}
width={800}
height={600}
// allowTransparency
/>
);
}
}
export default Metabase;