0

通过使用以下工具oAuth Playground并遵循文档Google Documents List API 3.0 版。这是我所做的。

  1. 我获得了以下 3 个范围的访问令牌。https://docs.google.com/feeds/ https://docs.googleusercontent.com/ https://spreadsheets.google.com/feeds/. 请参考以下附件。

    在此处输入图像描述

  2. 获得访问令牌和刷新令牌后,我开始查询,以获取特定文档的下载 URL。我提出了以下 GET 请求https://docs.google.com/feeds/default/private/full/?v=3。响应或多或少像


<entry ...
    ...
    <content type='application/zip' src='https://doc-0s-84-docs.googleusercontent.com/docs/securesc/4t...626&amp;e=download&amp;gd=true'/>
    ...
</entry>
  1. 然后我输入下载 URL https://doc-0s-84-docs.googleusercontent.com/docs/securesc/4t...626&amp;e=download&amp;gd=true。结果看起来像这样。

在此处输入图像描述

但是,我收到以下回复。

HTTP/1.1 302 Found
Status: 302
Content-length: 0
Via: HTTP/1.1 GWA
Set-cookie: AUTH_98m5tbqk1ftn500bl9bsjcrv52agg3u2_nonce=mupodp3rtqnoc; Domain=doc-0s-84-docs.googleusercontent.com; Expires=Thu, 14-Jun-2012 08:33:15 GMT; Path=/docs/securesc/4t66vjvgb1974sathdoeioitbft52pel; Secure; HttpOnly
Expires: Thu, 14 Jun 2012 08:23:15 GMT
X-google-cache-control: remote-fetch
Server: HTTP Upload Server Built on Jun 7 2012 12:49:38 (1339098578)
Location: https://docs.google.com/nonceSigner?nonce=mupodp3rtqnoc&continue=https://doc-0s-84-docs.googleusercontent.com/docs/securesc/4t66vjvgb1974sathdoeioitbft52pel/kea7kv7gjen26s72ovuvc0lc9to7ogf7/1339660800000/06447459084918146340/06447459084918146340/0B3MN1kmYytfaNWIwMzYzYzYtNmUxNS00OWMzLThkYzctZmUyNjg5MTY2NmUw?amp;gd%3Dtrue%26amp;e%3Ddownload%26h%3D16653014193614665626&hash=rtv0rrnj8bal21va48shlckqbjf5gjhm
Cache-control: private, max-age=0
Date: Thu, 14 Jun 2012 08:23:15 GMT
P3p: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Content-type: text/html; charset=UTF-8

我得到了相同的结果,即使我?v=3在 URL 后面附加了它看起来像https://doc-0s-84-docs.googleusercontent.com/docs/securesc/4t...626&amp;e=download&amp;gd=true?v=3

知道为什么我会收到这样的错误吗?

4

1 回答 1

2

您使用的 URL 是 URL 编码的。只需在 URL 中更改&amp;e=download&amp;gd=true为。&e=download&gd=true

于 2012-06-22T19:13:44.623 回答