henry sztul

henry sztul

Physicist. Entrepreneur. Dad.
more about me @ henry.sztul.com


Node, OAuth, and commas (oh my!)

I recently spent some time learning a bit of node.jsOAuth, and several well know API’s (twittertumblr, and more).  Learning a “new” language or framework is hard enough, but when you throw in dealing with authorization and responses from 3rd parties (AND shoddy internet) things get really messy!

Case in point:  In working with the newly released v2 of the Tumblr API, I repeatidly kept getting 401/unauthorized responses whenever I tried accessing my Tumblr Dashboard. I tried several things, all turned up nothing :(

Even more frustrating: I went back to my roots, Ruby, and everything worked fine!  I could get my dashboard, post things, the works!  Something was wrong in the node-oauth module and its communications with the Tumblr OAuth Provider.

After days of messing with things (oh so many things!), I found myself diving into the oauth headers that the node module created and compared them to the ruby oauth headers.  It turned out that there was a whitespace after the comma the ruby implementation and not the node implementation.  A !#!?!’ing WHITESPACE.  All other API’s I tested didn’t require that whitespace but Tumblr did. Argh!

Fork. Update. Push. Test. IT WORKED!

I also have recently spent some time building an OAuth provider.  The “provider” is responsible for creating consumer key’s and secret’s for 3rd party applications to begin the “dance” that allows 3rd parties access to a users data via an API.  Building this, I definitely appreciate the complexities surrounding small details such as commas in headers.

Tumblr did a great job in pushing a fix for this within a few days after I let them know. And I now know to check out for this in the headers my OAuth Provider generates. Sometimes being SOOOO strict is not a good thing… especially when you want people building with your shit!

Stay tuned to learn about the “building an OAuth provider” adventure.  That was a doosie! (yes I just used that word!)

Twilio: Web Service API for Making and Receiving Phone Calls, building hosted IVR and PBX telephone applications

Looks like a great API!

Top