Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Ruby library to the Yahoo! OAuth APIs
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Manifest
README.rdoc
Rakefile
init.rb
yahoo_oauth.gemspec

README.rdoc

Script example to create and refresh token:

require 'rubygems'
require 'yahoo_oauth' # :git => git://github.com/alx/yahoo_oauth.git
require 'yaml'

@config = YAML.load_file("config.yml")

@del_account = @config['delicious']

YAHOO_OAUTH_CREDENTIALS = {
  :consumer_key => @del_account['API_KEY'],
  :consumer_secret => @del_account['SHARED_SECRET']
}

unless File.exists? 'token.yml'

  client = YahooOAuth::Client.new(:callback => 'http://tetalab.org/oauth_verifier.php')

  p "1. open this url in your browser: #{client.authorize_url}"
  p "2. complete authorization process"
  p "3. enter verifier key in console: "
  oauth_verifier = gets.chomp

  client.authorize :oauth_verifier => oauth_verifier

  unless client.authorized?
    p "wrong verifier key, please try again"
    exit
  end

  client.save_token
end

YAHOO_TOKEN = YAML.load_file('token.yml')
YAHOO_OAUTH_SESSION_HANDLE_EXPIRED = YAHOO_TOKEN.params["oauth_session_handle"]

client = YahooOAuth::Client.new(:token => YAHOO_TOKEN.token, :secret => YAHOO_TOKEN.secret)
client.refresh_access_token
client.authorized?
Something went wrong with that request. Please try again.