尝试向 Tumblr 博客发帖时不断收到 401
通过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在此处检查您的基本字符串
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.