Getting Single-user OAuth to Work with the Tumblr API

Album Cover: Kid A

"We got heads on sticks. You got ventriloquists."
Radiohead / Kid A

Posted on January 11, 2013 3:09 PM in Programming
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

Before I get into the details of how I got single-user OAuth to work with the Tumblr API, I have to make a few comments about Tumblr's API itself. First and foremost, the JSON structure they return is very well done. Compliments end there, though, because they unfortunately make the bar to entry for prospective API consumers far too high.

The first thing you'll notice if you try to build your own Tumblr API-consuming application is that they immediately gloss over the first roadblock to building one: authentication. For example, the whole process of using OAuth to gain access is covered with the following three sentences:

Tumblr supports OAuth 1.0a, accepting parameters via the Authorization header, with the HMAC-SHA1 signature method only. There's probably already an OAuth client library for your platform.

If you've worked with Twitter's OAuth implementation, you'll feel right at home with ours.

Passing the responsibility for documentation off to Twitter, a direct competitor? Really? Granted, Twitter's API documentation sets the gold standard, but at least try!

It's that glossing over of the details that led me to wasting far too much time trying to obtain my OAuth access token and secret key. There is no definitive sample code on their site, but there is a handful of scripts that lead one to believe that the process is straightforward; however, that was not my experience.

What I found when running those scripts is that the final step of requesting the access token would always return a result of "Missing or invalid oauth_verifier." I was using the scripts as-is, only modifying the consumer key and secret, and having absolutely no luck. After contacting Tumblr support and being told my question was "too technical," it was recommended that I post a question in the Google Groups Tumblr API discussion forum. However, that forum requires you to apply to join just in order to ask a question. Like I said previously -- the bar to entry is unnecessarily high.

After contacting the developer behind one of the aforementioned scripts and not receiving a response, I decided to roll up my sleeves again and try to tackle the problem from a different angle. Since I was following the scripts to a tee and not having any luck, and getting an error that doesn't seem to have been run into very often by anyone else (yet), I wondered if maybe the version of my oauth2 module (1.0.2) was newer than the one used by those who had found success with those scripts. Or maybe it didn't support the older 1.0a version of OAuth that the Tumblr API still requires (though Wikipedia claims OAuth 2.0 should be backward-compatible).

Those thoughts led me to a different OAuth module for Python called Rauth. I very quickly tweaked their example code to work with the Tumblr API instead of Twitter's and ran the script. To my dismay, the script raised an exception:

TypeError: session() takes no arguments (1 given)

Because the script working out of the box would just be too easy, right? Upon realizing that the error was being thrown from within the Requests module that Rauth depends on, I was lucky enough to stumble upon a Stack Overflow post mentioning that a recent Requests version change was littered with backward-incompatible changes. It recommended rolling back to version 0.14.2, so I did the following from the command-line (on Linux):

sudo pip install --upgrade requests=0.14.2

I then ran my modified script again, and lo and behold, it ran to completion and printed out my access token and secret.

If you're at all interested in the script I ended up using to do so, you can check it out on Github.


Ryan on January 23, 2013 at 7:51 AM:

I remember similar struggles with Facebook authentication a few years ago. When I tried it again more recently with the graph API, it ended up being really straightforward. Good APIs make a big difference.


high PR dofollow blog comments service on September 05, 2016 at 2:53 AM:

A debt of gratitude is in order for the web journal stacked with such a large number of data. Halting by your web journal assisted me with getting what I was searching for.


instagram followers on September 28, 2016 at 3:22 AM:

Much obliged to you for the redesign, exceptionally decent site..


instagram likes on September 28, 2016 at 3:22 AM:

Much obliged to you for the redesign, exceptionally decent site..

Permalink this website  on October 06, 2016 at 5:59 AM:

I can't envision concentrating sufficiently long to research; considerably less compose this sort of article. You've beaten yourself with this material. This is extraordinary substance.


Cat Spraying No More Review on October 09, 2016 at 10:31 PM:

I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it..


b17 tablets on October 10, 2016 at 2:56 AM:

Great .. Astounding .. I'll bookmark your online journal and take the encourages likewise… I'm cheerful to discover such a large number of helpful information here in the post, we need work out more methods in such manner, a debt of gratitude is in order for sharing. b17 tablets


netflix on October 17, 2016 at 2:36 AM:

Positive site, where did u think of the data on this posting? I'm satisfied I found it however, sick be inquiring soon to discover what extra posts you incorporate. minecraft free download for pc netflix special offer code


netflix on October 17, 2016 at 2:39 AM:

This article gives the light in which we can watch the truth. This is extremely pleasant one and gives indepth data. Much obliged for this pleasant article. minecraft free download for pc netflix special offer code


netflix on October 17, 2016 at 2:40 AM:

A debt of gratitude is in order for the online journal stacked with such a variety of data. Ceasing by your online journal assisted me with getting what I was searching for. minecraft free download for pc netflix special offer code


Dubai on December 07, 2016 at 7:21 AM:

I really located you by mistake, while I was watching on google for something else,


voyance sans cb on December 08, 2016 at 10:46 PM:

thanks this is good blog.


versace shoes on January 05, 2017 at 6:39 AM:

Thank you for taking the time to publish this information very useful!
versace shoes


2017 trends on January 06, 2017 at 11:09 AM:

Just keep writing this kind of posts.


woman festival clothing on January 20, 2017 at 12:19 PM:

I have read your blog it is very helpful for me. I want to say thanks to you.


diabetes causas on January 25, 2017 at 12:31 PM:

This blog is so nice to me. I will keep on coming here again and again. Visit my link as well..

Permalink on January 31, 2017 at 11:44 PM:

Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks.


undershirts on February 01, 2017 at 11:36 PM:

Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon!


seo backlinks on February 05, 2017 at 9:52 PM:

Undoubtedly this is a phenomenal post I got a considerable measure of learning subsequent to perusing good fortunes. Subject of online journal is astounding there is just about everything to peruse, Brilliant post.


James Cangelosie on February 19, 2017 at 10:16 PM:

You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! High Trust Flow Backlinks


refinance rumah malaysia on April 02, 2017 at 2:00 PM:

The second one, it truly give alot of data to me ! I will be had with more comparative themes.


nmmcdorx on May 15, 2017 at 5:23 AM:
Web Design NYC on July 20, 2018 at 12:46 AM:

Especially superior to anything normal post. I simply revealed your weblog and anticipated that would express that I've extremely invigorating surfing around your blog areas. After all I'll be acquiring in to your feed and I trust you make again soon!


Web Design Studio on July 20, 2018 at 4:53 AM:

nice onee


Empanad arestaurant on July 22, 2018 at 7:19 PM:

Particularly better than anything common post. I fundamentally uncovered your weblog and foreseen that would express that I've unbelievably reviving surfing around your blog spaces.


seo service in bangladesh on July 24, 2018 at 12:09 PM:

i just love the ending part of your artical. best artical i ever read i understand very easily


Is Lasik Eye Surgery Worth the Cost? on July 24, 2018 at 6:24 PM:

i appriciate your work amazingly explain everything keep it up


Phatt Program on October 17, 2018 at 10:20 PM:

vegetables, fruit & water. It is this careful balance of food and nutritional support that make it possible to lose 10-15 kgs a month safely.


air conditioning Perth on October 30, 2018 at 9:15 PM:

Our aim is to always provide an exceptional service to our clients and maintain a solid presence in the community.


Freda on October 30, 2018 at 10:29 PM:

Thanks for this information. It really helped us.



oxandrolone on December 04, 2018 at 9:06 AM:

I think this is an informative post and it is very useful and knowledgeable.
I really enjoyed reading this post. big fan, thank you!


Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.


Email Address:



Check this box if you hate spam.