不接收驱动器的webhook通知,为什么? [英] Not receiving webhook notification from drive, why?

查看:133
本文介绍了不接收驱动器的webhook通知,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Google Drive SDK中的推送通知来接收所有更改的通知进入帐户后,我会按照注册域的步骤操作,然后创建通知频道,它起作用,我得到这个对象 Google_Service_Drive_Channel 来自 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);


//频道
$频道=新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);


//打印结果的响应
Google_Service_Drive_Channel对象

[address] =>
[expiration] => 1407171497000
[id] => xxxxxxxxxxxxxxxxxx
[kind] => api#channel
[params] =>
[有效载荷] =>
[resourceId ] => xxxxxxxxxxxxxxxxxxxx
[resourceUri] => https://www.googleapis.com/drive/v2/changes?includeDeleted=true&includeSubscribed=true&maxResults=100&alt=json
[数字] =>
[类型] =>
[modelData:protected] =>数组



[处理:保护] =>阵列




所以,我去谷歌驱动器帐户移动一些文件,但我仍然没有收到来自指定位置地址参数位置的webhook的任何内容。



我在收到频道时收到 X-Goog-Resource-State = sync 标头创建,但其他事件,如(添加,删除,垃圾,untrash,更改,更新)不。

任何帮助,谢谢

解决方案

这是我的错误解决方案将全域范围的权限委托给您的服务帐户


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
        (
        )

)

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.

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.

Any help, Thank's

解决方案

This was the solution for my bug Delegate domain-wide authority to your service account

这篇关于不接收驱动器的webhook通知,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆