Constantly getting 401 when trying to post to Tumblr blog

瘦欲@ 提交于 2019-12-20 01:36:55

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/6965216/constantly-getting-401-when-trying-to-post-to-tumblr-blog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!