Skip to content

Instantly share code, notes, and snippets.

@takuya-murao
Created March 15, 2013 14:33
Show Gist options
  • Save takuya-murao/5170252 to your computer and use it in GitHub Desktop.
Save takuya-murao/5170252 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/ruby
# coding: utf-8
require 'oauth'
require 'readline'
identica = {
site: 'https://identi.ca',
request_token_path: '/api/oauth/request_token',
access_token_path: '/api/oauth/access_token',
authorize_path: '/api/oauth/authorize'
}
consumer_key = Readline.readline('Consumer key: ', false)
consumer_sec = Readline.readline('Consumer secret: ', false)
consumer = OAuth::Consumer.new(consumer_key, consumer_sec, identica)
request_token = consumer.get_request_token
authorize_url = request_token.authorize_url
puts("Authorize URL: #{authorize_url}")
system("open '#{authorize_url}'")
pin = Readline.readline('Security code: ', false)
access_token = request_token.get_access_token({ oauth_verifier: pin })
puts('Access token: ' + access_token.token)
puts('Access token secret: ' + access_token.secret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment