1
我有一個基於Web的應用程序,它使用Google OAuth2.0作爲登錄框架。它以前工作很好,直到昨天。訪問令牌過期後,應用程序無法獲取刷新令牌。OAuth 2.0刷新令牌不可用?
如何刪除以下錯誤?
**PHP Fatal error**: Uncaught exception 'Google_AuthException' with message 'The OAuth 2.0 access token has expired, and a refresh token is not available.
下面是我的代碼:
if (isset($_GET['code'])) {
$client->authenticate($_GET['code']);
$_SESSION['access_token'] = $client->getAccessToken();
header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
}
if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
$client->setAccessToken($_SESSION['access_token']);
}