I am trying to create a JWT in PHP which appears to be working but the token is not valid with the app I'm using it for (Metabase).
Here's my code
use \Firebase\JWT\JWT;
$key = "acb...123";
$token = array (
    'resource' =>
        array (
            'dashboard' => 5333
        ),
        'params' => array (),
    );
$jwt = JWT::encode($token, $key);
This gives what looks like a valid result...
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjUzMzN9LCJwYXJhbXMiOltdfQ.xt2AuqbRZeJOQZ17xphCwMsikSaZDvMpG5ecydN6X08
But this is not a valid token for metabase
If I use an online JWT generator (https://www.jsonwebtoken.io/) I get a token (quite a bit longer) which does work but I can't see what's different about it.
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjUzMzN9LCJwYXJhbXMiOnt9LCJqdGkiOiI2MzczMDg4YS1iZmIwLTRmMDQtYWRhNi00ZmY2MzI4ZjJkNDAiLCJpYXQiOjE1NjAzMzQ2NDQsImV4cCI6MTU2MDMzODI0NH0.iMIvyAmemFyMq8QF00xYLdVoSpSnb_PjcrIsRVIE74c
EDIT:
OK, so having decoded the output from the online generator I get this...
stdClass Object
(
    [resource] => stdClass Object
        (
            [dashboard] => 5
        )
    [params] => stdClass Object
        (
        )
    [jti] => c1531882-1ca1-4d7f-a1a2-fc12862d40bc
    [iat] => 1560334984
    [exp] => 1560338584
)
What are the additional bits?
ANOTHER EDIT!
OK, so it seems it was nothing to do with the additional bits
This worked...
$token = json_decode('{
 "resource": {
  "dashboard": 5
 },
 "params": {}
}');
Is it still advisable to include the exp and iat, etc?