I'm working on a Twitter client that I intend to eventually post to Projects, but I've hit a stumbling block with OAuth authentication.
I'm using the excellent
Twitter OAuth implementation from Shannon Whitley. My application can successfully get an Authorization Link, and Twitter gives me a six-digit PIN. I'm having a devil of a time getting that PIN back to Twitter for the final authentication step.
I added the following method to Shannon's OAuth class:
public bool ValidatePin(string PIN)
{
string response = WebRequest(Method.GET, string.Format("{0}?oauth_verifier={1}", ACCESS_TOKEN, PIN), string.Empty);
if (response.Length > 0)
{
//Store the Token and Token Secret
var qs = HttpUtility.ParseQueryString(response);
if (!string.IsNullOrEmpty(qs["oauth_token"])) this.Token = qs["oauth_token"];
if (!string.IsNullOrEmpty(qs["oauth_token_secret"])) this.TokenSecret = qs["oauth_token_secret"];
return true;
}
else
{
return false;
}
}
I consistently get "401-Unauthorized" from Twitter when making the "oauth_verifier" call.
I know that my application's consumer_key and consumer_key_secret are valid, because I can successfully get the authorization link with the PIN.
I've been over the OAuth documentation and the Twitter API Wiki and haven't been able to turn up a solution.
Any help or guidance on this would be greatly appreciated, and I'll compose adoring haiku about you and include it in the code that I'll be releasing open-source.
posted by ignignokt at 7:21 AM on June 29