views:

90

answers:

2

I keep getting 401 when trying to login via Oauth with Twitter.

I'm using twitter_oauth-0.3.3 with oauth-0.3.6 in rails

It used to work perfectly some time ago, so after some digging, I realised it might have something to do with my timezone.

In the headers of the Twitter response, one of them is:

date: 
- Sun, 11 Apr 2010 16:53:34 GMT

Even though the time is actually 17:53:34 BST

I'm assuming the request is signed using BST time, and so it fails.

Anyone had this problem / found a fix for it?

A: 

Well, if the time is 17:53:34 BST, then it really is 16:53:34 GMT.

So, if the oauth library you're using can't cope with the server specifying the time in a different time-zone (are you certain that's what's causing the problem) then it could be a bug in the library.

(Not very helpful, I know - I don't use ruby and haven't done any oauth development myself.) Have you tried contacting the library developer(s)?

developmentalinsanity
A: 

The OAuth timestamp used in the signature is in the epoch time format.

You might want to inspect the Authorization request header, check for the oauth_timestamp and check what you are sending with this helpful online tool.

The difference between your epoch time and Twitter's (which you get in the response, as you wrote) should be in the +- 300 second frame.

Hope that helps!

Pablo Fernandez
thanks, it turned out that the time wasn't being calculated correctly when the request was generated.
Andrei Serdeliuc