POST returning 401 Not Authorized

744 views
Skip to first unread message

Andrew

unread,
Oct 1, 2012, 2:07:02 PM10/1/12
to tumbl...@googlegroups.com
I'm having a bizarre problem trying to post.  I make an access token request and receive the token.  I am able to get the dashboard, followers and blog info but when I make a post request and it fails with "401 Not Authorized".  I have captured the HTTP request using Wireshark for my app and another app and as far as I can tell they're identical.  I can send these captures to someone at Tumblr if they can have a look.  Also, I think this is intermittent - some days it works fine, other days not at all.

John Bunting

unread,
Oct 1, 2012, 2:30:56 PM10/1/12
to tumbl...@googlegroups.com
Hey Andrew,

What language are you using? I can supply you with some of my stuff in php or python, which you can test to see if it fails  intermittently. 

On Mon, Oct 1, 2012 at 2:07 PM, Andrew <ahamb...@gmail.com> wrote:
I'm having a bizarre problem trying to post.  I make an access token request and receive the token.  I am able to get the dashboard, followers and blog info but when I make a post request and it fails with "401 Not Authorized".  I have captured the HTTP request using Wireshark for my app and another app and as far as I can tell they're identical.  I can send these captures to someone at Tumblr if they can have a look.  Also, I think this is intermittent - some days it works fine, other days not at all.



--
John Bunting

Simplicity is prerequisite for reliability
    --Edsger W. Dijkstra


Andrew

unread,
Oct 1, 2012, 2:57:05 PM10/1/12
to tumbl...@googlegroups.com
I'm using Silverlight (C#).  Can I send you some text files offline to compare a working case vs a case where mine fails?  The requests look identical to me.

John Bunting

unread,
Oct 1, 2012, 3:06:05 PM10/1/12
to tumbl...@googlegroups.com
Before we do that let me ask you a few more questions:

1) Is it every POST request?
2) Are you urlencoding the body before you send it to us?
3) Are you using an OAuth Library to sign your requests?
4) If this is happening when you are creating posts, are you sure you're not trying to send us multipart data?

Steven Pears I believe has open sourced his Tumblr C# client with our API, you probably could take a look at his code and verify against your implementation without us having to exchange wireshark files :)

Andrew

unread,
Oct 1, 2012, 3:25:04 PM10/1/12
to tumbl...@googlegroups.com
1) Yes, it seemed to be working fine starting on Friday evening, and then starting last night it has failed for me every time.
2) Yes.
3) Yes, I'm actually using Steven Pears' library for posting now since I encountered the same issue with Hammock as he did for posting photos. 
4) No, this is happening for the simplest test post.
 
The two files I can provide are collected against my app and Steven's, and as I said the only differences that I can see are the keys.  I feel like there's something not right with my xAuth credentials, but of course 401: Not Authorized is not very descriptive.  I just resubmitted for another key for testing to see if that changes anything.

John Bunting

unread,
Oct 1, 2012, 3:26:40 PM10/1/12
to tumbl...@googlegroups.com
Email me the name of the app. 

Marco Tagliaferri

unread,
Nov 17, 2012, 12:03:09 AM11/17/12
to tumbl...@googlegroups.com
Is there an update on this? I am having the exact same problem... I am using a C# library that I've developed for Tumblr's API and that was working perfectly until a few days ago.

Right now all requests to methods using GET work fine (user/following, user/info, etc) but all requests using POST fail miserably with "401 Not Authorized".

I've triple-checked everything: signature base string, actual signature, actual request sent (via Fiddler) and everything is correct. Here is what my POST looks like if it could be of any help:


Authorization: OAuth oauth_consumer_key="<omitted>",oauth_nonce="d513b49b-5b60-4d15-a5e9-a845f5307e6e",oauth_signature="vRr7YU1zRA3TQSDz4XJ%2FT8kh%2FCw%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1353128428",oauth_token="<omitted>",oauth_version="1.0"
Content-Type: application/x-www-form-urlencoded
Content-Length: 34
Expect: 100-continue

id=35841961852&reblog_key=95VhBvum 


Been banging my head against this issue for 2 days now... any help would be greatly appreciated.

Thank you!

Marco

John Bunting

unread,
Nov 17, 2012, 7:33:23 AM11/17/12
to tumbl...@googlegroups.com
Verify that your timestamp is not off by more than an hour. The timestamp has to be within 1 hour or we reject the request. This was the problem Andrew's request. I just forgot to update the list.

Marco Tagliaferri

unread,
Nov 17, 2012, 2:08:34 PM11/17/12
to tumbl...@googlegroups.com
Hi John,

thanks for the quick reply. The timestamp is indeed correct: I am sending in the current UTC time (tried also to switch to local time just in case, but same result). Also, if it was incorrect, wouldn't the calls to the GET methods (user/following for example) fail too?

I will continue fiddling on my side, any other idea would be really appreciated though.

Thank you!

 Marco

Steven Pears

unread,
Nov 17, 2012, 4:56:27 PM11/17/12
to tumbl...@googlegroups.com
Marco
 
I’ve posted my C# library to this group if you want to compare code.
 
Are you using DateTime.UtcNow for the timestamp? And have you written your own encoder for the post data? Just asking that one as UrlEncode doesn't correctly encode punctuation well.
 
Hope we can get you back on track
 
Steven
 
Sent from Windows Mail
 

Marco Tagliaferri

unread,
Nov 17, 2012, 11:47:10 PM11/17/12
to tumbl...@googlegroups.com
Hi Steven,

I'm using DateTime.UtcNow (also verified that the unix-style timestamp converts back to the correct time). I've created the encoding function myself for the problem you described below, and it works fine as most of the other methods (the ones that are GET based) work ok.

I will have a look and try the code you posted to see if it makes any difference.

Thank you very much for your help!

Marco

Yura

unread,
Nov 19, 2012, 1:39:41 PM11/19/12
to tumbl...@googlegroups.com
Hi, Marko. Do you have a working example of the text post on С#?

воскресенье, 18 ноября 2012 г., 7:47:10 UTC+3 пользователь Marco Tagliaferri написал:
Reply all
Reply to author
Forward
0 new messages