Created
March 12, 2013 23:57
-
-
Save k0kubun/5148209 to your computer and use it in GitHub Desktop.
twitter for iphone consumer authentication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'oauth' | |
require 'thor' | |
require 'thor/group' | |
class Auth < Thor::Group | |
include Thor::Actions | |
def get_pid | |
consumer = OAuth::Consumer.new( | |
'IQKbtAYlXLripLGPWd0HUA', | |
'GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU', | |
:site => 'https://api.twitter.com' | |
) | |
request_token = consumer.get_request_token | |
say request_token.authorize_url | |
system 'open', request_token.authorize_url | |
pin = ask 'PIN:' | |
access_token = request_token.get_access_token( | |
:oauth_verifier => pin | |
) | |
puts "access_token: " + access_token.token | |
puts "access_token_secret: " + access_token.secret | |
end | |
end | |
Auth.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment