Created
May 1, 2012 18:17
-
-
Save GBH/2570212 to your computer and use it in GitHub Desktop.
Freshbooks OAUTH Song and Dance
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 'oauth/signature/plaintext' | |
c = OAuth::Consumer.new( | |
'account_name', 'oath_secret', { | |
:http_method => :post, | |
:scheme => :query_string, | |
:signature_method => 'PLAINTEXT', | |
:oauth_callback => 'oob', | |
:site => 'https://testingtesting0123.freshbooks.com', | |
:request_token_path => '/oauth/oauth_request.php', | |
:authorize_path => '/oauth/oauth_authorize.php', | |
:access_token_path => '/oauth/oauth_access.php' | |
} | |
) | |
request_token = c.get_request_token | |
puts request_token.authorize_url | |
code = gets.chomp | |
access_token = request_token.get_access_token :oauth_verifier => code | |
puts access_token.token | |
puts access_token.secret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment