MrZhouL / oauth

Automatically exported from code.google.com/p/oauth
0 stars 0 forks source link

Incorrect TimeStamp on OAuthBase.cs #137

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
As reported here:
http://blog.stevienova.com/2008/04/19/oauth-getting-started-with-oauth-in-c-
net/
GenerateTimeStamp() returns an incorrect timestamp, adding decimal points 
and hence generating an Invalid Signature response.

The solution there provided, however, is not totally correct since it does 
not account for different locales---i.e., the decimal point separator is not 
always a ".", but could also be a ",".

Original issue reported on code.google.com by giorgio....@gmail.com on 25 Nov 2009 at 1:43

GoogleCodeExporter commented 8 years ago
To be correct, the fix should be applied both on OAuthBase and in OAuthUtils. 
The
latter overrides GenerateTimeStamp() from OAuthBase trying to implement the same
thing in a different way.

return Convert.ToInt64(span.TotalSeconds).ToString();

is a correct implementation, while

string str = span.TotalSeconds.ToString();
    int index = str.IndexOf(".");
ecc...

is not. I suggest deleting OAuthUtil.GenerateTimeStamp() override.

Original comment by giancarl...@gmail.com on 25 Nov 2009 at 2:47

GoogleCodeExporter commented 8 years ago

Original comment by morten.f...@gmail.com on 5 Jan 2010 at 11:36