Skip to content

Commit

Permalink
Handle empty parameters
Browse files Browse the repository at this point in the history
As per this discussion: metabase/metabase#11101 (comment)
  • Loading branch information
ipeevski authored Nov 18, 2019
1 parent 7f1c11a commit 54920c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ private function encode($resource, $params)
{
$jwt = new \Lcobucci\JWT\Builder();
$jwt->set('resource', $resource);
$jwt->set('params', $params);
if (empty($params)) {
$jwt->set('params', (object)[]);
} else {
$jwt->set('params', $params);
}
$jwt->sign(new \Lcobucci\JWT\Signer\Hmac\Sha256(), $this->key);

return $jwt->getToken();
Expand Down

0 comments on commit 54920c9

Please sign in to comment.