gpt4 book ai didi

google-analytics - 带有参数的Google API提供了未知的授权 header

转载 作者:行者123 更新时间:2023-12-03 15:54:43 25 4
gpt4 key购买 nike

我有这个问题,通常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


这个问题在这里和那里以不同的形式被问了好几次,但是我找不到到目前为止解决的根本问题...

最佳答案

事实证明,Google要求在签名基本字符串上使用url参数:

GET&https%3A%2F%2Fwww.google.com%2Fanalytics%2Ffeeds%2Faccounts%2Fdefault&oauth_consumer_key%3DCONSUMERKEY%26oauth_nonce%3D88526211463343710%26oauth_signature_method%3DHMAC-SHA1%o26oauth_time %% 3D%3DCON%2%3%

->

GET&https%3A%2F%2Fwww.google.com%2Fanalytics%2Ffeeds%2Faccounts%2Fdefault&oauth_consumer_key%3DCONSUMERKEY%26oauth_nonce%3D88526211463343710%26oauth_signature_method%3DHMAC-SHA1%o26oauth_time %% 3%D3%26%10%26%32%

当然,按照字母顺序,其他所有参数也应如此。这解决了我的问题。

关于google-analytics - 带有参数的Google API提供了未知的授权 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8099880/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com