【问题标题】:Constantly getting 401 when trying to post to Tumblr blog尝试在 Tumblr 博客上发帖时不断收到 401
【发布时间】:2011-08-06 06:31:47
【问题描述】:

当我通过 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":[]}

有谁知道为什么?

【问题讨论】:

标签: tumblr


【解决方案1】:

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

http://quonos.nl/oauthTester/

您可以在这里查看所有内容

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

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

【讨论】:

  • 嗨,克里斯,我在 Tumblr 发布 reblog api 调用中收到 401(未授权),其他 tumblr api 工作正常。 api 响应:{"meta":{"status":401,"msg":"Not Authorized"},"response":[]}.
  • 在我的情况下,由于忘记包含在第一步中获得的 oauth_token_secret,我收到了 401。甚至没有想过要寻找它,因为他们引用了不使用它的 twitter 的 API。
猜你喜欢
  • 2012-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-10
  • 2015-04-25
  • 2015-04-16
  • 2019-07-01
  • 2013-06-02
相关资源
最近更新 更多