Google日历集成刷新令牌已过期

时间:2018-09-18 05:45:39

标签: php oauth google-calendar-api laravel-socialite

我正在使用Laravel社交名媛从Google获取我的Google日历事件。

下面是写在日历控制器功能的索引功能中的代码

 $googleCalendars = $this->google->getCalendar($request);
 $googleEvents = $googleCalendars->events->listEvents($this->google->getUserInfo()->email);

通过上述功能,我列出了与该用户有关的所有事件。

下面是用googlehelper.php编写的getUSerInfo函数

public function getUserInfo()
    {
        $oAuth    = new \Google_Service_Oauth2($this->googleClient());
        $userData = $oAuth->userinfo_v2_me->get();
        return $userData;
    }

来到$oAuth->userinfo_v2_me->get();之后,我遇到了以下错误:

{ "error": "invalid_grant", "error_description": "Bad Request" }

我认为我的刷新令牌即将过期。所以我的问题是,令牌过期后,该怎么解决?

0 个答案:

没有答案
相关问题