Hi,
I try to use those code php for embbed my dashboards, but doesn’t work. I have 2 codes. This both show this error “There was a problem displaying this chart.”
Errors in metabase logs:
*09-18 14:19:56 DEBUG middleware.log :: GET /api/embed/dashboard/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjF9LCJwYXJhbXMiOnsieW91cl9jdXN0b21fcGFyYW0iOjB9fQ.8bzu8dUt4hdVbAx8di-f7RP_M6RqGwHgvmAxecy2gis/dashcard/14/card/9 400 2,7 ms (2 DB calls) *
“Unknown parameter :your_custom_param.”
*09-18 14:19:58 DEBUG middleware.log :: GET /api/embed/dashboard/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjF9LCJwYXJhbXMiOnsicGFyYW1zIjpbXX19.jtIprjSbiXwU0MgMZ7G44DV1DwhqQhF_KW-GOsXbK34/dashcard/14/card/9 400 1,6 ms (2 DB calls) *
“Unknown parameter :params.”
index.php -->
############################################################
<?php
include 'vendor/autoload.php';
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Hmac\Sha256;
$metabaseSiteUrl = 'http://myserver.com:3000';
$metabaseSecretKey = 'db9a8cac9c5d3abe3b79dc46f0d479fc852952047052e22905df91e862126bf6';
$signer = new Sha256();
$token = (new Builder())
->set('resource', [
'dashboard' => 1
])
->set('params', [
'params' => []
])
->sign($signer, $metabaseSecretKey)
->getToken();
$iframeUrl = "{$metabaseSiteUrl}/embed/dashboard/{$token}#bordered=true&titled=true";
echo $iframeUrl;
echo "<iframe src=\"$iframeUrl\" >";
?>
############################################################
index2.php
############################################################
<?php
include 'vendor/autoload.php';
$metabaseSiteUrl = 'http://myserver.com:3000';
$metabaseSecretKey = 'db9a8cac9c5d3abe3b79dc46f0d479fc852952047052e22905df91e862126bf6';
$signer = new \Lcobucci\JWT\Signer\Hmac\Sha256();
$token = (new \Lcobucci\JWT\Builder())
->set('resource', ['dashboard' => 1])
->set('params', ['your_custom_param' => 0])
->sign($signer, $metabaseSecretKey)
->getToken();
$iframeUrl = "$metabaseSiteUrl/embed/dashboard/$token#bordered=true&titled=true";
//echo $iframeUrl;
echo $iframeUrl;
?>
<iframe src="<?php echo $iframeUrl ?>" frameborder="0"
width="100%"
height="800"
allowtransparency>
</iframe>
############################################################
Well, I don’t understand that why this error. What is the parameter that I need to add?
Details, my dashboard work on metabase and with Public embed.
Any suggestion?