【发布时间】:2012-08-17 18:15:48
【问题描述】:
我正在使用 php google calendar api v3。
在日历所有者授权后,我将 access_token 与刷新令牌一起保存在数据库中。
当日历页面被任何人显示时,我有一小段代码可以工作
$client = new apiClient();
$client->setApplicationName("My Calendar");
$client->setAccessType('offline');
$client->setAccessToken( $_SESSION['google']['access_token'] );
$calService = new apiCalendarService($client);
$optParams = array('timeMin' => $gstart, 'timeMax'=> $gend);
$events = $calService->events->listEvents($_SESSION['google']['google_cal_id'], $optParams);
我在文档中看到,在某些时候我可能必须使用刷新令牌(我在数据库中拥有。) 我不知道如何使用此令牌以及何时使用。 setAccessToken 会在某个时候抛出异常吗?什么是最好的测试方法 谢谢
【问题讨论】:
标签: php google-api google-calendar-api