Question

I'm writing an app to post on a users' behalf from a windows service. The user authorizes the application on a web-based flow elsewhere, their access token and secret are stored for later use. I'm using Linq-to-twitter to handle talking with twitter.

I'm using a SingleUserAuthorizer (below), but it seems that it is having trouble either signing the request or associating the request to a user. I get 401 - Could not authenticate you (32) errors every time I call equivalent of /account/verify_credentials.json?skip_status=true

The kicker is that it was working; and now has a 100% failure rate with no code changes. During debugging I've tried various values for my access token/secret and have regenerated both my client credentials and access token/secret. I've also tried with various previously known-good user tokens as well as generated new ones through other methods.

Any direction would be greatly appreciated. (snippets below).

var auth = new SingleUserAuthorizer()
{
    Credentials = new SingleUserInMemoryCredentials()
    {
        ConsumerKey = _consumerKey,
        ConsumerSecret = _consumerSecret,
        TwitterAccessToken = twitterAccessToken,
        OAuthToken = twitterAccessToken, // added during debugging
        AccessToken = twitterAccessSecret, // added during debugging
        TwitterAccessTokenSecret = twitterAccessSecret,
        UserId = userId // added during debugging
    }
};

auth.Authorize(); // added during debugging

var context = new TwitterContext(auth);
context.Log = Console.Out;

var account = context.Account
    .Where(t => t.Type == AccountType.VerifyCredentials)
    .FirstOrDefault(t => t.SkipStatus == true);
Was it helpful?

Solution

This turned out to be a bug where Account/VerifyCredentials wasn't handling parameters properly. I fixed it and the updates are now available via the downloadable Source Code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top