I threw one back and pulled it out on GitHub, calling rails3-mongoid-omniauth .
It allows authentication using various methods. It works provably on the Bamboo stack on Heroku with Rails 3.0.x. I have not updated it, but it should give you some ideas.
Some of the key files:
- omniauth.rb where suppliers are announced. It also includes monkeypatch to fix the LinkedIn provider, although I suspect it has already been fixed.
- routes.rb , where the route for this application is defined for each authentication provider. This is the callback URL that omniauth sends to the provider.
- application_controller.rb , where current_user is determined based on the session key.
- sessions_controller.rb , where a session is created based on authorization from an authentication provider (e.g. Google)
- _navigation.html.erb where the login links will take you to the authentication provider.
Now that I have done some more research, it looks like there is also a tutorial at http://railsapps.github.com/tutorial-rails-mongoid-omniauth.html .
source share