-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to post images: HTTP 401 Unauthorized #23
Comments
I didn't look too hard into the "why" here (which I'll do) but switch your syntax around to this: client.photo('blog.tumblr.com', :source => "http://url.to/photo.jpg", :state => "publish") Most likely something is happening to your parameters so they don't get signed properly and it's 401ing. |
Tried switching the syntax and that didn't fix it. Still getting a 401. |
Is there anyway to see exactly what kind of request is getting sent through the gem? Like a debug mode of some kind? |
Nope no debug mode per-say, but I'm assuming you've also gone through the 3-legged oauth step and have your access tokens. Could you post more code with exactly what you are doing? Just don't include your tokens in the post please :) |
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = api_key
config.consumer_secret = secret
config.oauth_token = my_token
config.oauth_token_secret = my_secret
end
client = Tumblr::Client.new
#require the above in IRB, then...
client.text("myblog.tumblr.com", {title: "test", body: "test even more"})
=>{"id"=>62355755631}
client.photo("funtesting.tumblr.com", :source => ["http://static.ddmcdn.com/gif/great-white-shark-1.jpg"], :state => "publish")
=>{"status"=>401, "msg"=>"Not Authorized"} |
Yes, I've gone through the oauth step. Like I said, posting text works just fine - the problem is with posting photos. |
And you have access to "funtesting.tumblr.com", as in, it's one of your blogs? |
Oh, also if you could toss in your version of ruby that'd help :) |
Ah figured it out. remove the |
I definitely do! Didn't mean to put that in the code actually haha. I just signed up and oauthed it yesterday. I'm running 2.0.0-p247. |
Ah yes, it works with one photo. But what if I wanted to upload many photos? |
In the past, giving it an array allowed me to do that if I remember correctly! |
well, therein lies the bug ;) I'll see if I can get this fixed and deployed out for you sometime today! |
I still get a 401 if I try to upload many: client.photo("funtesting.tumblr.com", :source => ["http://static.ddmcdn.com/gif/great-white-shark-1.jpg","http://images.nationalgeographic.com/wpf/media-live/photos/000/005/cache/great-white-shark_559_600x450.jpg"], :state => "publish") |
Thanks @codingjester !! |
Hey @zachfeldman I figured out the bug. It looks like SimpleOAuth is double encoding parameters that have a [ or a ] in their parameter name and we require that due to the way we require source parameters to be like so:
So I'm going to close this and file a bug against the client. |
Cool @codingjester , can you link me to the issue? Obviously need to find the resolution at some point so it would be great to track it. Thanks for looking into it! |
Why close this issue? If there is a bug in a 3rd party lib, it's not a reason to close an issue, imo. The gem doesn't work and an open issue should reflect that. |
I've also checked the issues of SimpleOAuth https://github.com/laserlemon/simple_oauth/issues and didn't see anything posted by you. |
You're right @ivanovv I must have forgot or got distracted. Thanks for calling me out. |
Great! |
@ivanovv interesting :) I'll pursue this during this weekend or the week. Thanks :) |
👍 😢 |
@codingjester no fix or workaround yet? :/ the simple_oauth issues didn't listed anything about tho :( |
as a possible workaround one can use :data => [], works for me with these versions
|
This issue will have its one year birthday in 24 days! 🍰 |
Blah i know @zachfeldman Terrible of me to let it languish as such. |
Is uploading an array through the On the other hand, the docs list that |
Looks like it'll be another few years before this issues gets closed lol, for now I'm unsubscribing to notifications... |
I am unable to post images using the client, but am able to post text.
Using the gem entirely outside of the context of my Rails application, I made many successful text posts, i.e.:
but when I attempt to make a photo post which I've been doing successfully for months, I get the following:
I've tried this with a few other blogs/oauth tokens. This one was just authorized/generated today (fake blog url). Any ideas?
The text was updated successfully, but these errors were encountered: