1
我有一个网站,用户希望有他们的谷歌日历 所有的例子似乎有日历的所有者每次验证。 有没有办法验证我的应用程序来获取用户日历数据并显示它?从谷歌日历检索事件使用PHP API脱机
我试图挽救车主的access_token
他们接受后,我的应用程序,但过了一会儿,我得到了以下错误:
The OAuth 2.0 access token has expired, and a refresh token is not available. Refresh tokens are not returned for responses that were auto-approved.
这是我想要的代码(BTW的config.php文件有所有的API东西填写)
$client = new Google_Client();
$client->setUseObjects(true);
$client->setApplicationName("My Unit Calendar");
$client->setAccessType('offline');
$client->setAccessToken($row['access_token']); //from the DB
$calService = new Google_CalendarService($client);
$events = $calService->events->listEvents($row['google_cal_id']); //from the DB
echo "events--><pre>".print_r($events,true)."</pre>";
,但我得到以下异常:
Google_AuthException-->The OAuth 2.0 access token has expired, and a refresh token is not available. Refresh tokens are not returned for responses that were auto-approved.
感谢您的任何帮助