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

corbanbrook / twitter_authentication

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 19
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (2)
    • master ✓
    • nery
  • Switch Tags (1)
    • v0.1.0
  • Branch List
Sending Request…

Sign in with Twitter OAuth: A Rails Generator plugin — Read more

  Cancel

http://weare.buildingsky.net

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Updated README 
corbanbrook (author)
Wed Jul 08 13:14:19 -0700 2009
commit  155f261a364b81815e3f1cf35a45dd3b5d21a18d
tree    0fc36bf5b5da547bb20f01625cc888f3e43087ac
parent  a8fd7ebf4fb685143e51781fc80f6b6f35255e42
twitter_authentication /
name age
history
message
file MIT-LICENSE Wed Jun 17 14:20:35 -0700 2009 staged plugin for alpha testing [corbanbrook]
file README Wed Jul 08 13:14:19 -0700 2009 Updated README [corbanbrook]
file Rakefile Wed Jun 17 14:20:35 -0700 2009 staged plugin for alpha testing [corbanbrook]
directory generators/ Sat Jun 20 08:59:28 -0700 2009 added some exception handling [corbanbrook]
file install.rb Wed Jun 17 14:20:35 -0700 2009 staged plugin for alpha testing [corbanbrook]
directory lib/ Wed Jun 17 14:20:35 -0700 2009 staged plugin for alpha testing [corbanbrook]
README
                            Twitter Authentication


This is a "Sign in with Twitter"-oauth authorization generator for rails, based
closely on the restful_authentication plugin by Rick Olson which can be found at
http://github.com/technoweenie/restful-authentication/tree/master.

"Sign in with Twitter" is the pattern of authentication that allows users to
connect their Twitter account with third-party services in as little as one
click.


Step 1 - Installation:

  ./script/plugin install git://github.com/corbanbrook/twitter_authentication.git


Step 2 - Generate Authentication System:

  ./script/generate twitter_authenticated user sessions

  The first parameter specifies the model that bootstraps the twitter account
  (typically a user or account model).

  The second parameter specifies the sessions controller name.  This is the
  controller that handles the actual login/logout function on the site.


Step 3 - Migrate User Account Model

  View the created migration and see if it meets your need. This model bootstaps
  itself onto the users twitter account and caches all user details. Any additional
  fields you require to store should be added to the migration at this time.

  ./rake db:migrate RAILS_ENV=development|production

Step 4 - Register Application with Twitter:

  Visit http://twitter.com/oauth_clients/ and register a new application.

  Point the Callback url to: http://your.application.url/sessions/callback

  Upon completion you will receive a consumer key and secret you will need to
  add to config/twitter_oauth.yml

Step 5 - Add Authentication to your Controllers

  To add authentication to protect your controllers use a before_filter

  ie.

    before_filter :login_required


* Now your application should be ready to go? *


Requirements:

* Twitter gem by John NuneMaker http://twitter.rubyforge.org/
  an API wrapper for Twitter and Twitter Search API's

  gem install twitter



API

* login_required

  Use on controllers to autheticate access to individual pages.

  ie.

  class UsersController < ApplicationController
    before_filter :login_required, :except => 'index'
    ..
  end

* authorized?, logged_in?

  Show the logged in state of the user.





@corban                                                    weare.buildingsky.net
________________________________________________________________________________

       Copyright (c) 2009 Corban Brook, released under the MIT license
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