Goodreads Developers discussion

190 views
examples / showcase > really simple ruby oauth example

Comments (showing 1-3 of 3) (3 new)    post a comment »
dateDown arrow    newest »

message 1: by Michael, Problems Architect (last edited Jul 31, 2012 02:24PM) (new)

Michael Economy (michaeleconomy) | 615 comments Mod
#example authenticates and prints the raw xml for the friend updates.
require 'oauth'
key = BLAH #substitute your keys
secret = BLAH

consumer = OAuth::Consumer.new(key, secret, {:site => "http://www.goodreads.com"})
request_token = consumer.get_request_token
p request_token.authorize_url

#user needs to go to this url and approve it

access_token = request_token.get_access_token
p access_token.get("/updates/friends.xml").body


message 2: by Chris (new)

Chris (chrisnolanca) | 9 comments I was following the example at http://www.goodreads.com/api/oauth_ex... in irb which seems to have come out of this post.

I ran into an error (OAuth::VERSION not defined) and it seems that the require "oauth/consumer" should just be require "oauth".


message 3: by Michael, Problems Architect (new)

Michael Economy (michaeleconomy) | 615 comments Mod
I've put the require in that example, thanks Chris.


back to top

unread topics | mark unread