OauthBundle
OauthBundle bundles devise and Omniauth twitter, facebook, and github strategies. It migrate required columns for your authentication model. Omniauth callbacks controller file is created and defined realted methods. This gem makes your life easier to build the omniauth services with devise gem.
###To-Do List:
Support seperating authentication model from user model.
Installation
Test in OS X system.
Add this line to your application's Gemfile:
gem 'devise'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-github'
gem 'oauth_bundle'
And then execute:
$ bundle
Or install it yourself as:
$ gem install oauth_bundle
Usage
Setup
rails g oauth_bundle:install
Update your app id and app secret for each provider:
# config/initializers/devise.rb
config.omniauth :github, 'APP_ID', 'APP_SECRET'
config.omniauth :facebook, 'APP_ID', 'APP_SECRET'
config.omniauth :twitter, 'APP_ID', 'APP_SECRET'
Handle Callback Data
Each provider correspond to its named method in app/controllers/#{models}/omniauth_callbacks_controller.rb
.
Routing Path
user_omniauth_authorize_path(:provider_name)
user_omniauth_callback_path(:provider_name)
More Information
- http://blog.railsrumble.com/2010/10/08/intridea-omniauth/
- https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
- https://github.com/mkdynamic/omniauth-facebook
Contributing
- Fork it ( https://github.com/[my-github-username]/oauth_bundle/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Development Digest
- Add migration for authentication model.
- Add
provider, uid
columns to authentication model. - Setup before start to use it.
- Set tup provider in model.
- integrate
rails g devise:install
andrails g devise user
git add . && git commit --amend --no-edit && rake install
"/app" => absolute path
"app" => relative path, current execution path prefixed.
test your sqlite db: sqlite3 /db/development.sqlite3
-
http://localhost:3000/rails/info/routes
get route info - Twitter dont like developers develop their app under
localhost
as callback url. 😑 - http://www.rubydoc.info/github/erikhuda/thor/master/Thor/Actions#get-instance_method
- http://stackoverflow.com/questions/6338908/ruby-difference-between-exec-system-and-x-or-backticks
rake build && gem push <gem>.gem