Ruby-on-rails – User auth example in Rails 3, using Devise, OmniAuth, Mongoid, and JSON responses


I have integrated Devise and OmniAuth with my Mongoid ORM setup using the following examples:

My client code is mostly JavaScript (ExtJS) and relies on JSON for all of the communication. I use no Rails templates. I am looking to build a multi-provider authentication model, primarily using user/pass, Facebook, and Twitter. I am having difficulty putting together the full User authentication flow with respect to my application stack.

I am looking for an example that uses JSON responses to the standard authentication actions, instead of redirects, and provides an integration with OmniAuth that uses Mongoid. In addition to the above examples, I have gone through Ryan Bates' Railscasts on Devise and OmniAuth. Every example I have worked through so far have either been ActiveRecord, or Rails template oriented. Any pointers are appreciated!

Best Solution

This ( is a good example app for getting set up with rails 3, devise, omniauth and mongoid, and a tutorial to go along with it here:

Then you'll need to override the user sessions controller to provide the correct json responses for your app, there is a good example here: and here:

Hope this helps

Related Question