这是我的gmail观看请求推送通知代码
define('SCOPES', implode(' ', array(
Google_Service_Gmail::MAIL_GOOGLE_COM)
));
$this->client = new Google_Client();
$this->client->setApplicationName(APPLICATION_NAME);
$this->client->setScopes(SCOPES);
$this->client->setAuthConfig(CLIENT_SECRET_PATH);
$this->client->setAccessType('offline');
$this->client->setApprovalPrompt('force');
$credentialsPath = CREDENTIALS_PATH;
if(!file_exists($credentialsPath)){
redirect('gmail');
}
$accessToken = json_decode(file_get_contents($credentialsPath), true);
$this->token = $accessToken['access_token'];
$this->client->setAccessToken($accessToken);
if ($this->client->isAccessTokenExpired()) {
$refreshTokenSaved = $this->client->getRefreshToken();
$this->client->fetchAccessTokenWithRefreshToken($refreshTokenSaved);
//$client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
file_put_contents($credentialsPath, json_encode($this->client->getAccessToken()));
}
$service = new Google_Service_Gmail($this->client);
$watchreq = new Google_Service_Gmail_WatchRequest();
$watchreq->setLabelIds(array('INBOX'));
$watchreq->setTopicName('projects/composed-field-201410/topics/wooglobe');
$msg = $service->users->watch('me', $watchreq);
我收到此错误 输入:Google_Service_Exception
消息:{"错误":{"错误":[{"域":"全球","原因& #34;:" backendError"," message":" Backend Error" },"代码":500,"消息":"后端错误" }}
文件名:D:\ xampp \ htdocs \ viralgreats \ admin \ vendor \ google \ apiclient \ src \ Google \ Http \ REST.php
行号:118