Hi Duane,
When you get the 401 what does the body say?
Thanks;
– Matt Sanford / @mzsanford
Twitter Dev
On Jun 29, 2009, at 4:29 AM, DWRoelands wrote:
I'm having a devil of a time getting my application to connect to
Twitter via OAuth and the six-digit pin method.
I've been working with the excellent OAuth library from
ShannonWhitley:
http://www.voiceoftech.com/swhitley/?p=681
I'm able to get an authorization link, open a browser, and get the
six-
digit PIN. However, I can't seem to submit that PIN back to Twitter
without getting a 401 Unauthorized error.
I added this method to Shannon's TWitter OAuth code:
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;
}
}
Inevitably, I get 401 Unauthorized when submitting the
"oauth_verifier" web request.
I have a consumer key and a consumer key secret which work (as is
evidenced by the fact that I can get an authorization link).
Has anyone else encountered similar issues, or does anyone else have
any guidance on this particular issue?
Thanks in advance.
--Duane