尝试向 Tumblr 博客发帖时不断收到 401

发布于 2024-11-28 05:33:37 字数 944 浏览 3 评论 0原文

通过 v2 API 发布到 Tumblr 时,我不断收到 401 错误,但没有进一步解释错误是什么。

请求如下 - 添加换行符以提高可读性

POST http://api.tumblr.com/v2/blog/[blog].tumblr.com/post HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: api.tumblr.com
Content-Length: 303

body=test&
oauth_consumer_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&
oauth_nonce=4712451&
oauth_signature_method=HMAC-SHA1&
oauth_timestamp=1312610497&
oauth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&
oauth_version=1.0&
type=text&
oauth_signature=ccN%2f0E%2bat42BAzdkDPJ%2ffcuMacY%3d

我得到以下响应

HTTP/1.1 401 Not Authorized
Date: Sat, 06 Aug 2011 06:01:43 GMT
Server: Apache
P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
Vary: Accept-Encoding
X-Tumblr-Usec: D=38791
Content-Length: 60
Connection: close
Content-Type: application/json

{"meta":{"status":401,"msg":"Not Authorized"},"response":[]}

有谁能发现原因吗?

I'm getting a 401 constantly without further explanation of what the error is when posting to Tumblr via the v2 API.

Requests are below - linebreaks are added for readibility

POST http://api.tumblr.com/v2/blog/[blog].tumblr.com/post HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: api.tumblr.com
Content-Length: 303

body=test&
oauth_consumer_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&
oauth_nonce=4712451&
oauth_signature_method=HMAC-SHA1&
oauth_timestamp=1312610497&
oauth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&
oauth_version=1.0&
type=text&
oauth_signature=ccN%2f0E%2bat42BAzdkDPJ%2ffcuMacY%3d

I get the following response

HTTP/1.1 401 Not Authorized
Date: Sat, 06 Aug 2011 06:01:43 GMT
Server: Apache
P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
Vary: Accept-Encoding
X-Tumblr-Usec: D=38791
Content-Length: 60
Connection: close
Content-Type: application/json

{"meta":{"status":401,"msg":"Not Authorized"},"response":[]}

Does anyone can spot why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城旧梦 2024-12-05 05:33:37

您可以在此处检查您的基本字符串

http://quonos.nl/oauthTester/

并且您可以在此处检查所有内容

< a href="http://hueniverse.com/oauth/guide/authentication/" rel="nofollow">http://hueniverse.com/oauth/guide/authentication/

另外,就我个人而言,当我的签名包含 + 时,我遇到了一些麻烦,正如您上面的那样(+ = %2b urlencoded)。我通过测试签名中的 + 并重新签名(如果有)解决了问题。

You can check your base string here

http://quonos.nl/oauthTester/

and you can check everything here

http://hueniverse.com/oauth/guide/authentication/

Also, personally I've had some trouble when my signature included a +, as yours does above, (+ = %2b urlencoded). I solved the problem by testing for the + in my signature and re-signing if it did.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文