【发布时间】:2011-11-19 05:51:38
【问题描述】:
我有这个问题,通常 api 入口点可以正常工作:
https://www.google.com/analytics/feeds/accounts/default
但是当我添加如下参数时:
https://www.google.com/analytics/feeds/accounts/default?max-results=50
然后它失败了。如果有人能说出问题所在,这就是互动的一部分:
GET&https%3A%2F%2Fwww.google.com%2Fanalytics%2Ffeeds%2Faccounts%2Fdefault&oauth_consumer_key%3DCONSUMERKEY%26oauth_nonce%3D88526211463343710%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1321044173%26oauth_token%3DCONSUMERTOKEN%26oauth_version%3D1.0
{ host: 'www.google.com',
path: '/analytics/feeds/accounts/default?max-results=25',
method: 'GET',
headers: { Authorization: 'OAuth oauth_token="CONSUMERTOKEN", oauth_timestamp="1321044173", oauth_nonce="88526211463343710", oauth_consumer_key="CONSUMERKEY", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature="S%2Bob3FyVFpwRsu4x7C%2FwmkwbnDY%3D"' } }
STATUS: 401
HEADERS: {"www-authenticate":"GoogleLogin realm=\"http://www.google.com/accounts/ClientLogin\", service=\"analytics\"","content-type":"text/html; charset=UTF-8","date":"Fri, 11 Nov 2011 20:42:56 GMT","expires":"Fri, 11 Nov 2011 20:42:56 GMT","cache-control":"private, max-age=0","x-content-type-options":"nosniff","x-frame-options":"SAMEORIGIN","x-xss-protection":"1; mode=block","server":"GSE","connection":"close"}
response: Unknown authorization header
这个问题在这里和那里有不同的变化,但我找不到到目前为止解决的根本问题......
【问题讨论】:
-
我也有同样的问题。非常令人沮丧。对我来说,问题出在带有 PUT 请求的 Google Calendar api 中。仅当我将 v=2 或 gsessionid 参数附加到 url 时才会发生这种情况。
-
请看下面我的回答。基本字符串和发布的值需要完全匹配,这至少是我的问题。
标签: google-analytics google-api gdata