Search code examples
ruby-on-railsapirubygemshttp-status-code-403tumblr

403 Error when Authenticating using tumblr gem for rails application


I have a ruby-on-rails application that wishes to utilise the tumblr gem for adding posts when an action is taken (eg: creating a blog post)

I currently have the tumblr gem installed and can manage to fetch my posts using

@tumblruser = Tumblr::User.new('myemail','mypassword')

However when i go to add a post where it asks me to pass the user information like so (according to the API for the gem)

post = Tumblr::Post.create(@tumblruser, :type => 'video', :embed => @post.video_html, :title => @post.title, :caption => @post.content)

it just does not want to authenticate and returns a 403 error

anyone had any experience with this?


Solution

  • NEW SOLUTION: I have found recently that there has been a problem with the gem. So I have made a copy of it, changed a few things in the docs and code and put it at http://rubygems.org/gems/matenia-tumblr-api

    Hope the changes and docs help someone else out there. As always I welcome any improvements, or refactoring on any of my projects. Kind Regards, Matenia

    OLD ANSWER BELOW

    I managed to get around this by the way ... all i did was declare the username and password in place of @tumblruser like so:

    post = Tumblr::Post.create(:email => 'user name email here', 
            :password => 'my password', 
            :type => 'video', 
            :embed => @post.video_html, 
            :caption => @postcontent)
    

    where @postcontent is the html text of post.content and gsubbed to escape most of the html.

    hope this saves someone else some time.