github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mojodna / oauth forked from pelle/oauth

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 122
    • 34
  • Source
  • Commits
  • Network (34)
  • Issues (7)
  • Downloads (15)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (4)
    • compat-19
    • master ✓
    • rspec
    • rspec+oauth-1.0a
  • Tags (15)
    • v0.3.6
    • v0.3.5.1
    • v0.3.5
    • v0.3.4.1
    • v0.3.4
    • v0.3.3
    • v0.3.2.1
    • v0.3.2
    • v0.3.1.5
    • v0.3.1.4
    • v0.3.1.3
    • v0.3.1.2
    • v0.3.1.1
    • v0.3.1
    • v0.3.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

OAuth for Ruby — Read more

  cancel

http://oauth.rubyforge.org/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

note about curb support 
mojodna (author)
Sat Feb 06 22:23:27 -0800 2010
commit  7e77bc6cac7c90cc8b05ef8d9d1251c6371a8fba
tree    00144f63b314b94c7cd1847690c547ba2bb54695
parent  4ea98a415698e76e907280ed6c495148771ef280
oauth /
name age
history
message
file .gitignore Sat Dec 12 18:30:19 -0800 2009 Add .gitignore [quirkey]
file History.txt Sat Feb 06 22:23:27 -0800 2010 note about curb support [mojodna]
file License.txt Mon Jan 21 11:13:42 -0800 2008 Changes from http://oauth.googlecode.com/svn/co... [pelle]
file Manifest.txt Sat Feb 06 10:28:10 -0800 2010 Add files to Manifest [Darcy Laycock]
file README.rdoc Sat Feb 06 22:18:57 -0800 2010 Add em-http-request usage link [Darcy Laycock]
file Rakefile Sat Feb 06 10:35:19 -0800 2010 add em-http-request as a dev dep [mojodna]
file TODO Sat Feb 06 11:35:22 -0800 2010 TODO [andrehjr]
directory bin/ Sun May 03 21:00:50 -0700 2009 display warnings and require rubygems [mojodna]
directory examples/ Mon May 18 13:40:15 -0700 2009 removed unused assignment [mojodna]
directory lib/ Sat Feb 06 22:18:50 -0800 2010 Fix the tests for the em related stuff [Darcy Laycock]
file oauth.gemspec Fri Jan 01 19:55:55 -0800 2010 Re-generated gemspec from jeweler [quirkey]
directory script/ Wed Jan 21 20:49:22 -0800 2009 bumped version to 0.2.99 [mojodna]
file setup.rb Mon Nov 26 22:10:32 -0800 2007 First commit [pelle]
directory tasks/ Tue Sep 09 10:39:37 -0700 2008 Updated deployment info to be 0.2.6 [pelle]
directory test/ Sat Feb 06 22:18:50 -0800 2010 Fix the tests for the em related stuff [Darcy Laycock]
directory website/ Wed Jun 03 09:52:02 -0700 2009 0.3.5 release [mojodna]
README.rdoc

Ruby OAuth GEM

What

This is a RubyGem for implementing both OAuth clients and servers in Ruby applications.

See the OAuth specs oauth.net/core/1.0/

Installing

  sudo gem install oauth

You can also install it from the oauth rubyforge project rubyforge.org/projects/oauth/.

The source code is now hosted on the OAuth GitHub Project github.com/mojodna/oauth

The basics

This is a ruby library which is intended to be used in creating Ruby Consumer and Service Provider applications. It is NOT a Rails plugin, but could easily be used for the foundation for such a Rails plugin.

As a matter of fact it has been pulled out from an OAuth Rails Plugin code.google.com/p/oauth-plugin/ which now requires this GEM.

Demonstration of usage

Create a new consumer instance by passing it a configuration hash:

  @consumer = OAuth::Consumer.new("key","secret", :site => "https://agree2")

Start the process by requesting a token

  @request_token = @consumer.get_request_token
  session[:request_token] = @request_token
  redirect_to @request_token.authorize_url

When user returns create an access_token

  @access_token = @request_token.get_access_token
  @photos = @access_token.get('/photos.xml')

Now that you have an access token, you can use Typhoeus to interact with the OAuth provider if you choose.

  oauth_params = {:consumer => oauth_consumer, :token => access_token}
  hydra = Typhoeus::Hydra.new
  req = Typhoeus::Request.new(uri, options)
  oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(:request_uri => uri))
  req.headers.merge!({"Authorization" => oauth_helper.header}) # Signs the request
  hydra.queue(req)
  hydra.run
  @response = req.response

For more detailed instructions I have written this OAuth Client Tutorial stakeventures.com/articles/2008/02/23/developing-oauth-clients-in-ruby and "How to turn your rails site into an OAuth Provider ":stakeventures.com/articles/2007/11/26/how-to-turn-your-rails-site-into-an-oauth-provider .

If you wish to use em-http-request, you can find an example "in the official em-http-request repository":github.com/igrigorik/em-http-request/blob/master/examples/oauth-tweet.rb

Finally be sure to check out the OAuth RDoc Manual oauth.rubyforge.org/rdoc/ .

Documentation Wiki

There is some documentation on the Google Code project for the "OAuth Rails Plugin":code.google.com/p/oauth-plugin/ :

  • RequestToken code.google.com/p/oauth-plugin/wiki/RequestToken
  • AccessToken code.google.com/p/oauth-plugin/wiki/AccessToken

Forum

groups.google.com/group/oauth-ruby

How to submit patches

Read the "8 steps for fixing other people’s code" drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.

The source code is now hosted on the OAuth GitHub Project github.com/mojodna/oauth

To submit a patch, please fork the oauth project and create a patch with tests. Once you’re happy with it send a pull request and post a message to the google group.

License

This code is free to use under the terms of the MIT license.

Contact

Comments are welcome. Send an email to "Pelle Braendgaard" pelleb@gmail.com email via the OAuth Ruby mailing list groups.google.com/group/oauth-ruby

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server