天天看點

php jwt token過期時間,關于php-jwt過期時間的問題

php jwt token過期時間,關于php-jwt過期時間的問題

藍山帝景

我也有用這個庫,過期時間是有用的啊,你是怎麼設定的$tokenId    = base64_encode(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));

            $issuedAt   = time();

            $notBefore  = $issuedAt + 20;            

            $expire     = $notBefore + 60*60;            

            $serverName = 'xxx.com';

            $key = C('DATA_AUTH_KEY');

            $token = array(                "iss" => $serverName,                "iat" => $issuedAt,                "exp" => $expire,                "jti" => $tokenId,                "data" => $user

            );

            $jwt = JWT::encode($token, $key);