我正在使用 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 会在某个时候抛出异常吗?什么是最好的测试方法谢谢