PHP JWT Token Firma inválida

Estoy buscando durante una hora y no puedo encontrar una solución a este problema.

Este es el código para generar el token JWT. solíahttps://github.com/firebase/php-jwt biblioteca.

        $tokenId    = base64_encode(mcrypt_create_iv(32));
        $issuedAt   = time();
        $notBefore  = $issuedAt + 10;             //Adding 10 seconds
        $expire     = $notBefore + 60;            // Adding 60 seconds
        $serverName = 'serverName'; // Retrieve the server name from config file

        $secretKey = base64_decode(getenv('JWT_SECRET'));

         $data = [
            'iat'  => $issuedAt,         // Issued at: time when the token was generated
            'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token
            'iss'  => $serverName,       // Issuer
            'nbf'  => $notBefore,        // Not before
            'exp'  => $expire,           // Expire
            'data' => [                  // Data related to the signer user
                'userId'   => '1', // userid from the users table
                'userName' => $UserName, // User name
            ]
        ];

        $jwt = JWT::encode(
                $data,      //Data to be encoded in the JWT
                $secretKey, // The signing key
                'HS256'     // Algorithm used to sign the token
        );

        $unencodedArray = ['jwt' => $jwt];
        echo json_encode($unencodedArray);

Y verifico el token enhttps://jwt.io/

¿Alguien puede ayudarme con este problema? Actualmente soy nuevo en JWT. Por cierto, mi proyecto es Slim API.

Muchas gracias.

Respuestas a la pregunta(1)

Su respuesta a la pregunta