相关疑难解决方法(0)

PHP JWT令牌无效签名

我现在正在寻找一个小时,无法找到解决这个问题的方法.

这是生成JWT令牌的代码.我使用https://github.com/firebase/php-jwt库.

        $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 …
Run Code Online (Sandbox Code Playgroud)

php slim jwt

1
推荐指数
1
解决办法
2297
查看次数

标签 统计

jwt ×1

php ×1

slim ×1