Skip to content

Instantly share code, notes, and snippets.

@k0kubun
Created March 12, 2013 23:57
Show Gist options
  • Save k0kubun/5148209 to your computer and use it in GitHub Desktop.
Save k0kubun/5148209 to your computer and use it in GitHub Desktop.
twitter for iphone consumer authentication
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