Browse files

updated documentation to clarify API key usage and local testing

  • Loading branch information...
1 parent 4975a77 commit cee42546220be0822162a4b5a9227ed2d163dd5c @tardate committed Aug 13, 2009
Showing with 28 additions and 13 deletions.
  1. +28 −13 README.rdoc
@@ -3,7 +3,7 @@
Prepared by: paul gallagher -
Demonstration site:
+Related blog post:
== Purpose
@@ -30,17 +30,17 @@ NB: for heroku deployment, these are specified in the .gems file in the root of
= STEP-BY-STEP (how the app was created)
-1. Install oauth gem
+== 1. Install oauth gem
gem install oauth
-2. create the application shell
+== 2. create the application shell
rails rails-twitter-oauth-sample
cd rails-twitter-oauth-sample
rake db:create
-3. create a member scaffold
+== 3. create a member scaffold
ruby script/generate scaffold member twitter_id:integer screen_name:string token:string secret:string profile_image_url:string
@@ -50,11 +50,11 @@ Member model updated to use screen_name as the key:
-4. Prepare the database
+== 4. Prepare the database
rake db:migrate
-5. Create the oauth support in ./lib
+== 5. Create the oauth support in ./lib
@@ -73,14 +73,14 @@ oauth_system.rb
* It includes wrappers for many of the twitter api methods, basically to reroute errors into the flash hash.
-6. Modify MembersController to use OAuth
+== 6. Modify MembersController to use OAuth
# include the oauth_system mixin
include OauthSystem
# specify oauth to be on all user-specific actions
before_filter :oauth_login_required, :except => [ :callback, :signout, :index ]
-7. Specify routes
+== 7. Specify routes
Map members resources
Hook /members/callback method to module OauthSystem.callback
@@ -97,7 +97,7 @@ For the sample app, use MembersController.index as the landing page:
map.root :controller => "members"
-8. Customise views and controller methods for some basic functionality
+== 8. Customise views and controller methods for some basic functionality
MembersController actions
@@ -109,7 +109,7 @@ MembersController actions
* partialdms - xhr responder to render direct messages list
-9. Add rake task to demonstrate proxy-login
+== 9. Add rake task to demonstrate proxy-login
See lib/tasks/test.rake:
demo_proxy_login task connects as the last member and exercises the API a bit
@@ -118,19 +118,34 @@ To execute:
rake demo_proxy_login
-10. Configuring twitter application keys
+== 10. Configuring twitter application keys
Register your application at
-Add the twitter application key and consumer secret to the environment (or edit config/environment.rb)
+Note the "application key" and "consumer secret" numbers that twitter generates - these are unique for your application
+and are required to complete the configuration.
+Add the twitter application key and consumer secret as operating system environment variables
+(TWOAUTH_KEY and TWOAUTH_SECRET respectively).
+Alternatively, you can edit config/environment.rb to set these directly.
-e.g. for heroku, add the environment keys:
+If you are using heroku, add the environment keys using the heroky utility (gem):
heroku config:add TWOAUTH_KEY=8N029N81 TWOAUTH_SECRET=9s83109d3+583493190
+== 11. Testing the application locally
+When you register the application at twitter, you will specify a fully qualified callback URL
+This is the address that twitter sends users back to after the twitter authentication step.
+To test on a local development machine (not known on the web/in DNS) as the domain name in the callback,
+you can simply add the registered domain to your hosts file (aliasing localhost) e.g.
+NB: most browsers will need to be restarted each time you change this,
+as the resolved name will have been cached if you have already used the address.

0 comments on commit cee4254

Please sign in to comment.