Created
February 15, 2011 21:11
-
-
Save kvnsmth/828251 to your computer and use it in GitHub Desktop.
A quick script to get an OAuth access token
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
# run from a command line to get the access token information | |
require 'rubygems' | |
require 'oauth' | |
@consumer_key = "YOUR_CONSUMER_KEY" | |
@consumer_secret = "YOUR_CONSUMER_SECRET" | |
@consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret, { | |
:site => "http://api.awesomeapp.com" # example: "http://api.twitter.com" | |
}) | |
@[email protected]_request_token | |
# visit URL output here and authorize | |
puts @request_token.authorize_url | |
# type PIN in here and press enter | |
pin = gets | |
@access_token = @request_token.get_access_token(:oauth_token_secret => pin) | |
# TADA! | |
puts "token: #{@access_token.token}" | |
puts "secret: #{@access_token.secret}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment