简体   繁体   English

OAuth 2.0刷新令牌不可用?

[英]OAuth 2.0 refresh token is not available?

I have a web based application which use Google OAuth2.0 as the login framework. 我有一个基于Web的应用程序,它使用Google OAuth2.0作为登录框架。 It works nicely previously until yesterday. 之前一直有效,直到昨天。 The applcation couldn't get the refresh token after the access token expired. 访问令牌过期后,应用程序无法获取刷新令牌。

How can I remove the following error? 如何清除以下错误?

**PHP Fatal error**: Uncaught exception 'Google_AuthException' with message 'The OAuth 2.0 access token has expired, and a refresh token is not available.

Below is my code : 下面是我的代码:

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']);
}

OAuth2访问令牌可以过期,您必须使用“刷新令牌”对其进行刷新-它始终与访问令牌一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM