RE: xAuth always failed with 401 (c# code)

73 views
Skip to first unread message

Steven Pears

unread,
Jun 27, 2012, 5:00:44 AM6/27/12
to tumbl...@googlegroups.com
Hi James
 
The xauth code looks like it should produce the same result as my own XAuth code. If you’re sure about your signature code then the most likely possibility is that it’s one of the details in the sig - what code are you using to generate the timestamp?
 
Steven

James Zhou

unread,
Jun 27, 2012, 10:11:24 PM6/27/12
to tumbl...@googlegroups.com
Here's the method:
public string GenerateTimeStamp()
        {
            
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalSeconds).ToString();
        }

James Zhou

unread,
Jun 27, 2012, 10:33:06 PM6/27/12
to tumbl...@googlegroups.com
Steven, I update my post with values for xauth. You may find any problems in them  https://groups.google.com/forum/?fromgroups#!topic/tumblr-api/wCJpIfUy1qs 


On Wednesday, June 27, 2012 5:00:44 PM UTC+8, Steven Pears wrote:

Steven Pears

unread,
Jun 28, 2012, 1:41:11 AM6/28/12
to tumbl...@googlegroups.com
Sorry James - I didn't realise this has created a new thread when I replied on my phone!
 
Although you're using UtcNow for your current date, your epoch date hasn't been adjusted for local time offsets.
 
Try new DateTime(1970, 1, 1, 0, 0, 0, 0).ToUniversalTime() instead - that will give you the correct timestamp.
 
Steven

James Zhou

unread,
Jun 28, 2012, 5:48:00 AM6/28/12
to tumbl...@googlegroups.com
Thanks Steven. But this make no difference, still got 401 error
Reply all
Reply to author
Forward
0 new messages