Posts Tagged ‘pin’

How to sign in with PIN-based twitter using oauth gem

Sunday, June 28th, 2009

Twitter uses PIN-based oauth to the desktop applications. This document explains how it works. All things are same as normal oauth procedure except PIN. After finishing authorization with Twitter, user sees 6 digit PIN number on twitter. This PIN number has to be included to the access_token request with oauth_verifier parameter to get access token successfully.

oauth gem  is a great tool if you inted to use oauth with ruby. This is how to send oauth_verifier parameter with oauth gem. Until version 0.3.4, oauth_verifier parameter has to be included in the body.

acc_token = req_token.get_access_token({}, {:oauth_verifier => pin})

From version 0.3.5, oauth gem has the oauth_verifier in oauth parameters. So the below is also possible.

acc_token = req_token.get_access_token({:oauth_verifier => pin})

Good luck!