NOTE - THIS IS FORKED TO FIX QUIRKS IN AN IMPLEMENTATION, NOT TO IMPROVE ON THE REFERENCE IMPLEMENTATION, WHICH IS AVAILABLE AT github.com/mojodna/oauth
This is a forked version of the OAuth RubyGem that addresses a couple of quirks in a particular OAuth implementation. DO NOT fork from here or use this version of the Gem unless you want an implementation that doesn’t strictly follow the OAuth spec.
See the OAuth specs oauth.net/core/1.0/
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
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.
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')
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 .
Finally be sure to check out the OAuth RDoc Manual oauth.rubyforge.org/rdoc/ .
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
groups.google.com/group/oauth-ruby
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.
This code is free to use under the terms of the MIT license.
Comments are welcome. Send an email to “Pelle Braendgaard” [email protected] email via the OAuth Ruby mailing list groups.google.com/group/oauth-ruby