1

我正在关注文档https://developers.google.com/drive/push以接收来自 Google Drive 的推送通知。

  1. 我的域已注册(在 API 控制台的 API 访问窗格中)。
  2. 我在注册域中有一个自定义程序,通过 htpps 侦听(带有自签名证书)。https://myveryowndomain.bc.com/drive/notifications
  3. 为任何更改正确创建通知通道(获取响应代码 200)。
  4. 我在我的 Google Drive 文件中进行了更改,但没有任何内容2,甚至没有同步消息。

我错过了什么吗?

CONFIG: -------------- REQUEST  --------------
POST https://www.googleapis.com/drive/v2/changes/watch
Accept-Encoding: gzip
Authorization: Bearer 1/QRYL1ZHO4KyUmjkbHVWXCWglxJ5e6-xxxxxxxxxxxxx
User-Agent: push-test-project Google-HTTP-Java-Client/1.15.0-rc (gzip)
Content-Type: application/json; charset=UTF-8
Content-Length: 150

Jul 24, 2013 6:02:04 PM com.google.api.client.http.HttpRequest execute
CONFIG: curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'Authorization: Bearer 1/QRYL1ZHO4KyUmjkbHVWXCWglxJ5e6-xxxxxxxxxxxxx' -H 'User-Agent: push-test-project Google-HTTP-Java-Client/1.15.0-rc (gzip)' -H 'Content-Type: application/json; charset=UTF-8' -d '@-' -- 'https://www.googleapis.com/drive/v2/changes/watch' << $$$
Jul 24, 2013 6:02:04 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 155 bytes
Jul 24, 2013 6:02:04 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: {"address":"https://myveryowndomain.bc.com/drive/notifications","id":"f143f7ba-759a-42b8-8748-e39a71ba13cc","type":"web_hook"}
Jul 24, 2013 6:02:08 PM com.google.api.client.http.HttpResponse <init>


CONFIG: -------------- RESPONSE --------------
HTTP/1.1 200 OK
ETag: "RFvxxXV9yoZniidCHgcusodAlXI/AaEAn8d9Ma5bpJZNmM0F72Crxxx"
Content-Length: 247
X-XSS-Protection: 1; mode=block
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Server: GSE
X-Content-Type-Options: nosniff
Pragma: no-cache
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
X-Frame-Options: SAMEORIGIN
Date: Wed, 24 Jul 2013 09:02:08 GMT
Content-Encoding: gzip
Content-Type: application/json; charset=UTF-8

Jul 24, 2013 6:02:08 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 296 bytes
Jul 24, 2013 6:02:08 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: {
 "kind": "api#channel",
 "id": "f143f7ba-759a-42b8-8748-e39a71ba13cc",
 "resourceId": "_X2yFKJJ6yLq3eIrw3OSxxxxxxx",
 "resourceUri": "https://www.googleapis.com/drive/v2/changes?includeDeleted=true&includeSubscribed=true&maxResults=100&alt=json",
 "token": "",
 "expiration": "1374660126357"
}
4

1 回答 1

2

自签名 SSL 似乎是这里的问题。这不仅仅是关于加密。这也是关于信任问题。您可以从StartSSLCACert获得免费的 SSL 。

仅供参考,过期标头不是通道的过期时间。这是关于缓存的信息。您可以在响应正文的“过期”字段中找到您的频道实际过期时间。它以 unix 时间格式表示,您的响应“1374660126357”实际上是“Wed, 01 Apr 45531 03:05:57 GMT”。更改通道的默认到期时间为 1 周。

于 2013-07-24T16:50:13.597 回答