README.rdoc in oauth-plugin-0.4.0.pre4 vs README.rdoc in oauth-plugin-0.4.0.pre5
- old
+ new
@@ -65,10 +65,18 @@
This generates OAuth and OAuth client controllers as well as the required models.
It requires an authentication framework such as acts_as_authenticated, restful_authentication or restful_open_id_authentication. It also requires Rails 2.0.
+=== INSTALL RACK FILTER (NEW)
+
+A big change over previous versions is that we now use a rack filter. You have to install this in your application.rb file:
+
+ require 'oauth/rack/oauth_filter'
+ config.middleware.use OAuth::Rack::OAuthFilter
+
+
=== Generator Options
The generator supports the defaults you have created in your application.rb file. eg:
config.generators do |g|
@@ -323,15 +331,18 @@
Add entries to OAUTH_CREDENTIALS for all OAuth Applications you wish to connect to. Get this information by registering your application at the particular applications developer page.
OAUTH_CREDENTIALS={
:twitter=>{
:key=>"key",
- :secret=>"secret"
+ :secret=>"secret",
+ :client=>:twitter_gem, # :twitter_gem or :oauth_gem (defaults to :twitter_gem)
+ :expose => false, # set to true to expose client via the web
},
:agree2=>{
:key=>"key",
- :secret=>"secret"
+ :secret=>"secret",
+ :expose => false, # set to true to expose client via the web
},
:hour_feed=>{
:key=>"",
:secret=>"",
:options={
@@ -368,10 +379,14 @@
@location=@user.fire_eagle.client.location
The client method gives you a OAuth::AccessToken which you can use to perform rest operations on the client site - see http://oauth.rubyforge.org/rdoc/classes/OAuth/AccessToken.html
+If you are using Mongoid you want to add an embeds_many association in your user model:
+
+ embeds_many :consumer_tokens
+
=== Custom ConsumerToken models
Before creating the FireEagleToken model the plugin checks if a class already exists by that name or if we provide an api wrapper for it. This allows you to create a better token model that uses an existing ruby gem.
Currently we provide the following semi tested tokens wrappers:
@@ -389,23 +404,54 @@
/oauth_consumers/[SERVICE_NAME]
Where SERVICE_NAME is the name you set in the OAUTH_CREDENTIALS hash. This will request the request token and redirect the user to the services authorization screen. When the user accepts the get redirected back to:
/oauth_consumers/[SERVICE_NAME]/callback
-
+
You can specify this url to the service you're calling when you register, but it will automatically be sent along anyway.
+=== Expose client
+
+This is designed to let your local javascript apps access remote OAuth apis. You have to specifically enable this by adding the expose flag to your oauth config file. eg:
+
+ OAUTH_CREDENTIALS={
+ :twitter=>{
+ :key=>"key",
+ :secret=>"secret",
+ :client=>:oauth_gem, # :twitter_gem or :oauth_gem (defaults to :twitter_gem)
+ :expose => true # set to true to expose client via the web
+ }
+
+Once the user has authorized your application, you can access the client APIs via:
+
+ /oauth_consumers/[SERVICE_NAME]/client/[ENDPOINT]
+
+For example to get the user's Google Calendars in JSON (documented in their API as "https://www.google.com/calendar/feeds/default?alt=jsonc"), you would append that path as the ENDPOINT above, i.e.
+
+ /oauth_consumers/google/client/calendar/feeds/default?alt=jsonc
+
+As another example, to get my Twitter info as XML (available at "https://api.twitter.com/1/users/show.xml?screen_name=pelleb"), use:
+
+ /oauth_consumers/twitter/client/1/users/show.xml?screen_name=pelleb
+
=== Migrate database
The database is defined in:
db/migrate/XXX_create_oauth_consumer_tokens.rb
Run them as any other normal migration in rails with:
rake db:migrate
+== Contribute and earn OAuth Karma
+
+Anyone who has a commit accepted into the official oauth-plugin git repo is awarded OAuthKarma:
+
+https://picomoney.com/oauth-karma/accounts
+
+
== More
The Mailing List for all things OAuth in Ruby is:
http://groups.google.com/group/oauth-ruby
@@ -416,6 +462,6 @@
The OAuth Ruby Gem home page is http://oauth.rubyforge.org
Please help documentation, patches and testing.
-Copyright (c) 2007-2010 Pelle Braendgaard and contributors, released under the MIT license
\ No newline at end of file
+Copyright (c) 2007-2011 Pelle Braendgaard and contributors, released under the MIT license