Like Taylor said, find your time offset relative to Twitter's.  The
WP7 Emulator timestamp is terribly off, and it is probably a good idea
to keep your own offset anyway with devices that may have been off-
network a long time (or in the future, zune devices which dont have a
source).

In my personal library (based on the real basic OAuthBase.cs) I'm
grabbing the timestamp and calculating an offset from the system
clock, so I only have to grab the time every so often.

I didn't see if the timestamp Hammock uses is injectable though.

On Sep 1, 1:21 am, Hongwei <suhongwe...@gmail.com> wrote:
> Hi guys,
>
> Does anyone know what is wrong with my code? it always returns "Failed
> to validate oauth signature and token" (it did return access token and
> access access secret few day ago)
>
> here is my code (I use Hammock/TweetSharp library)
>
> private const string _consumerKey = "cKey";
> private const string _consumerSecret = "cSecret";
> private string _userName = "uName";
> private string _password = "uPassword";
>
> Button.Click
> {
>  Hammock.RestClient c = new RestClient()
>                                        {
>                                            Authority = "https://
> api.twitter.com/oauth/",
>                                            HasElevatedPermissions =
> true,
>                                            Credentials = new
> OAuthCredentials()
>                                            {
>                                                Type =
> OAuthType.ClientAuthentication,
>                                                ConsumerKey =
> _consumerKey,
>                                                ConsumerSecret =
> _consumerSecret,
>                                                SignatureMethod =
> OAuthSignatureMethod.HmacSha1,
>                                                ParameterHandling =
> OAuthParameterHandling.HttpAuthorizationHeader,
>                                                ClientUsername =
> _userName,
>                                                ClientPassword =
> _password,
>                                            }
>                                        };
>
>             RestRequest r = new RestRequest()
>                                 {
>                                     Path = "access_token",
>                                 };
>             c.BeginRequest(r, new RestCallback(Callback));
>
> }
>
>  public void Callback(Hammock.RestRequest request,
> Hammock.RestResponse response, object userState)
>         {
>             var a = response.Content;           (I set debug here, and
> variable 'a' contains "Failed to validate oauth signature and token",
> RestRespone.content contains "'Content' threw an exception of
> type"System.UnauthorizedAccessException"
>         }
>
> Thanks

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to