Not receiving webhook notification from drive, why?(没有收到来自驱动器的 webhook 通知,为什么?)
问题描述
我正在尝试使用来自 Google Drive SDK 的 推送通知 来接收所有更改的通知进入一个帐户,我按照步骤注册域,然后创建通知频道 并且它有效,我从 google-api-php-client:
Im trying to use push notification from Google Drive SDK for receive notification for all changes into an account, I follow the steps Registering domain, then creating notification channel and it works, I get this object Google_Service_Drive_Channel
from google-api-php-client:
$client = new Google_Client();
$client->setApplicationName("APP_NAME");
$service = new Google_Service_Drive($client);
$key = file_get_contents('my_private_key_location.p12');
$cred = new Google_Auth_AssertionCredentials(
'email_address_from_the_client@developer.gserviceaccount.com',
array('https://www.googleapis.com/auth/drive'),
$key
);
$client->setAssertionCredentials($cred);
// Channel
$channel = new Google_Service_Drive_Channel();
$channel->setId(uniqid());
$channel->setAddress('https://my.custom.url');
$channel->setKind('api#channel');
$channel->setType('web_hook');
$test = $service->changes->watch($channel);
print_r($test);
// Response printing the result
Google_Service_Drive_Channel Object
(
[address] =>
[expiration] => 1407171497000
[id] => xxxxxxxxxxxxxxxxxx
[kind] => api#channel
[params] =>
[payload] =>
[resourceId] => xxxxxxxxxxxxxxxxxxxx
[resourceUri] => https://www.googleapis.com/drive/v2/changes?includeDeleted=true&includeSubscribed=true&maxResults=100&alt=json
[token] =>
[type] =>
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
所以,我去谷歌驱动器帐户移动一些文件,但我仍然没有收到来自指定地址"参数位置内的 webhook 的任何内容.
So, I go to the google drive account for move some file, but I still don't receive anything from the webhook inside the location specified "address" parameter.
我在创建频道时收到 X-Goog-Resource-State = sync
标头,但其他事件(如(添加、删除、垃圾、取消垃圾、更改、更新))没有.
I receive X-Goog-Resource-State = sync
header just when the channel is created, but others events like (add, remove, trash, untrash, change, update) don't.
任何帮助,谢谢
推荐答案
这是我的错误的解决方案 将域范围的权限委派给您的服务帐户
This was the solution for my bug Delegate domain-wide authority to your service account
这篇关于没有收到来自驱动器的 webhook 通知,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:没有收到来自驱动器的 webhook 通知,为什么?
基础教程推荐
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01