Created
March 12, 2010 22:51
-
-
Save stympy/330890 to your computer and use it in GitHub Desktop.
This file contains 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
ca = ClientApplication.create(:name => 'Test Consumer App', :url => 'http://consumerapp.local') | |
consumer = OAuth::Consumer.new(ca.key, ca.secret, :site => 'http://localhost:3000') | |
request_token = consumer.get_request_token | |
`open #{request_token.authorize_url}` | |
# after POSTing that form... | |
db_request_token = RequestToken.last | |
# the POST would redirect to #{ca.callback_url}?oauth_token=#{db_request_token.token}&oauth_verifier=#{db_request_token.verifier} if ca.callback_url is not nil | |
access_token = OAuth::RequestToken.new(consumer, request_token.token, db_request_token.token).get_access_token(:oauth_verifier => db_request_token.verifier) | |
access_token.get('/some/protected/action') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment