Tumblr OAuth image post gives me 401/“Invalid OAuth credentials”

旧巷老猫 提交于 2019-12-01 20:57:27

Having exactly the same problem with my OAuth implementation in Silverlight - I've implemented the rest of the API without an issue, and this method works if you don't use OAuth and just send email/password headers as well.

Arvin's post just showed me the issue though, he's including the other non-file fields in his OAuth. I just did the same to my post, so they were in the multi-part form body but also being added to the OAuth sig - and now I'm uploading photo posts without a problem!

I just made a dump of the base string that my app is generating when posting a photo entry to Tumblr. Linebreaks added to lessen the obscurity. Hope it helps.

POST&http%3A%2F%2Fwww.tumblr.com%2Fapi%2Fwrite&
caption%3D%253Cp%253Etesting%253C%252Fp%253E%26
click-through-url%3D%26
format%3Dhtml%26
generator%3D%253C%2520href%253D%2522http%253A%252F%252Fsudocode.net%252Fprojects%252Fpicasa-2-tumblr%2522%253EPicasa2Tumblr%253C%252Fa%253E%26
group%3Darvn.tumblr.com%26
oauth_consumer_key%3Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%26
oauth_nonce%3Db0f187f5d0781b3d6aea0f192e116524%26
oauth_signature_method%3DHMAC-SHA1%26
oauth_timestamp%3D1296560370%26
oauth_token%3DwkR9Jjtnp0tMPHp3aqcxvRd401cUeVX7PzxUrc0Y8SZZRoLHgs%26
oauth_version%3D1.0%26
private%3D0%26
slug%3D%26
state%3Ddraft%26
tags%3D%26
type%3Dphoto

One thing, you didn't notify Tumblr that you're going to post a photo using the type parameter.

I had the same problem. It was because my I was including a blank Tumblr secret.

This is where you get it: http://www.tumblr.com/oauth/apps -> "Show secret key"

Also, I'm using the xAuth stuff with their https://www.tumblr.com/oauth/access_token url.

I hope this helps. I'm on Rails with the Devise gem.

Had the same problem: it seems like the OAuth library I used (GTM OAuth) was not using the POST Data fields for the signature. After I've added the fields type and caption additionally as a query string, the OAuth library used them and I was able to upload a photo/post/whatever.

Seems like every post body field (except for the binary data) needs to be part of the OAuth signature.

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