Skip to content

Instantly share code, notes, and snippets.

@bluemango
Created July 14, 2010 17:53
Show Gist options
  • Save bluemango/475757 to your computer and use it in GitHub Desktop.
Save bluemango/475757 to your computer and use it in GitHub Desktop.
require "google_util"
consumer = OAuth::Consumer.new('anonymous', 'anonymous', {
:site => 'https://www.google.com',
:request_token_path => '/accounts/OAuthGetRequestToken',
:access_token_path => '/accounts/OAuthGetAccessToken',
:authorize_path => '/accounts/OAuthAuthorizeToken'
})
## I have also tried the above with :site => 'https://apps-apis.google.com'
request_token = consumer.get_request_token({}, {:scope => 'https://apps-apis.google.com/a/feeds/user/#readonly'})
puts request_token.authorize_url
access_token = request_token.get_access_token(:oauth_verifier => THE_TOKEN_YOU_GET_FROM_THE_SITE)
puts access_token.token
puts access_token.secret
client = Google::Client.new(access_token, '2.0')
feed = client.get('https://apps-apis.google.com/a/feeds/visualfaq.com/user/2.0', {
'xoauth_requestor_id' => "admin@visualfaq.com",
})
## I get RESPONSE IS #<Net::HTTPForbidden 403 Invalid OAuth signature. readbody=true>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment