-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 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 > Hi Duane,
Might I recommend my OAuth implementation for Twitter? It's based on Shannon's code and is up to date for the new PIN authentication. You can fetch the code from http://twarp.googlecode.com's SVN repository, and there are also fairly recent binaries on the download page. There are also C# examples in SVN, showing both synchronous and asynchronous login workflow. Regards, - -- Bojan Rajkovic <[email protected]> Biochemistry '10, Brandeis University PGP Signature Key ID: 0x8783D016 PGP Encryption Key ID: 0x2497B8B2 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQIcBAEBCgAGBQJKSYhzAAoJEO4IwQyHg9AWydkP/1gBJN4u9SWJtgPZmrmCrlFJ R+Ge2o3Byy/BboMGyDs8fVgfeJvIlnzK3lQWC7zflfQNCClc0crlM3TFP9cfd8Bf 3ugk6KZnYDYZIRtTJGqttnpCuxAc40NziS5xV4S2kWgBlp4YfyW1YBvcludLG5FG wY7f+ww2vkVrPSPoMbfiHWuLfgGUHvlPnPVV8yeXp1o3UNRTunq7NoSXnfgHO8om ZGYyt9OszgPPDp5bsbcNqEAmM/tMTq1ohpisQ7WQkxLMPZcsJ0al1L1/oMxKptkW lX4SzEGyliEBGv0XagqjNlH1p+kIDH+jvnv4W+Zu26wWv8F0jy83F0s61EN9QAtp H6a7Ao/d0lE39zlbE7e3v16z+RUKiPSW25WoFCXtVxDnlcto3nE1llikHgBKLEA+ MYtMaQUNYCnOlIwSw0J+6Qv3nAcJUxJ3JP7f0H1uXH0LjtborSXzbtPrSxvCApTW 9AVzhO4r3BqgvoHdGQh4rQtk7RxJ4xtyXaty+UkATOB6d0ogqtX53IYf1/FWMTe5 ZSFpWHvqqogxu15/OIwkcUatJwrKjt80mplif+HsPhwmj7B97gRdwJogJ83XAGhb ocEq8q7L62nzkXnxblOJXUxvGfeVxxUpZaYGWwAj9tx2qzwtczBt7oMJIOkQVHcY WOwo/NmDsaFx8VTSPC4j =/KC3 -----END PGP SIGNATURE-----
