Does Google OpenID work with Ruby code sample?

I went through quite a few Google OpenID Rails / Rails authentication examples, but none of them worked properly. Most of them do not work because they are out of date. They will not even omni for some other reason.

Does anyone have a working Ruby Rack web application example that works correctly?

+4
source share
2 answers

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 .

+1
source

I would check out this Rails Cast, which should help you launch and run On On Open ID and omniauth in general in Ruby-based Rails applications.

http://railscasts.com/episodes/304-omniauth-identity

By the way, if you are going to highlight Rails development, Railscast is a great source of information.

+1
source

All Articles