问题令牌在Google API上过期


Problems token expires on Google API

大家早上好,使用google-api-client到PHP对用户进行身份验证,但是在某个时间过期'访问令牌'并再次调用身份验证用户,有人知道设置或修改文件以使令牌持续更长时间,当然感谢您的帮助。

我有同样的问题,在我的情况下,我使用了一个名为isAccessTokenExpired()的方法,然后再次进行身份验证请求

if (isset($_SESSION['token'])) {
      googleClient->setAccessToken($_SESSION['token']);
}
if (googleClient->isAccessTokenExpired()) {
    $authUrl = googleClient->createAuthUrl();
    header("Location:$authUrl");
}