问题描述
通过 v2 API 发布到 Tumblr 时,我不断收到 401,但没有进一步解释错误是什么.
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
我收到以下回复
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":[]}
有人能找出原因吗?
推荐答案
您可以在这里查看您的基本字符串
You can check your base string here
你可以在这里查看所有内容
and you can check everything here
http://hueniverse.com/oauth/guide/authentication/
此外,就个人而言,当我的签名包含 + 时,我遇到了一些麻烦,就像您在上面所做的那样,(+ = %2b urlencoded).我通过测试签名中的 + 并重新签名(如果有)解决了这个问题.
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.
这篇关于尝试发布到 Tumblr 博客时不断收到 401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!