objective-ciostumblrxauth

Xauth 401 Error When Authenticating with Tumblr with Objective-C


I haven't been able to find a solution for getting an Objective-C and XAuth working for Tumblr. I found many Twitter examples so what seemed to make sense was to hijack Twitter-XAuth and replace the token_access url with Tumblr's. I've been stuck on this problem for hours because all I get in return from Tumblr is a 401 error when I authenticate.

The app is registered with Tumblr and is XAuth enabled.

I can't figure out what it is I'm doing wrong.

My Basestring: POST&https%3A%2F%2Fwww.tumblr.com%2Foauth%2Faccess_token&oauth_consumer_key%3D[consumer key]%26oauth_nonce%3D-1943440940%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1334174720%26oauth_version%3D1.0%26x_auth_mode%3Dclient_auth%26x_auth_password%3D[password]%26x_auth_username%3Dmalcolmbastien%40gmail.com

For my authorization header, NSLog seems to print out the '\' characters when escaping a double quotation, but I can't tell if they are present in the request or not.

My Authorization Header: { Authorization = "OAuth oauth_nonce=\"-1943440940\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1334174720\",oauth_consumer_key=\"[consumer key]\",oauth_signature=\"a2a%2BImFSzi1BCGV2FVzah6RPlVA%3D\",oauth_version=\"1.0\"";

Let me know if there's other code I should be sharing.

Thanks.


Solution

  • This pull request that hasn't been merged yet url encodes the user name and password. Because Tumblr uses email addresses for usernames, it needs to bu url encoded.

    Anybody wanting to use Twitter-xauth should check this out https://github.com/ericjohnson/twitter-xauth/pull/3