Skip to content

Instantly share code, notes, and snippets.

@GBH
Created May 1, 2012 18:17
Show Gist options
  • Save GBH/2570212 to your computer and use it in GitHub Desktop.
Save GBH/2570212 to your computer and use it in GitHub Desktop.
Freshbooks OAUTH Song and Dance
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