plataformatec/devise — pull request #1663 by mreinsch (2012-02-19 05:02:53+00:00)
Title: Sketch for less intrusive use of omniauth

This is more a sketch for now, and I'd like to get some feedback on it. My goals where to have devise use omniauth in a less intrusive way so that omniauth can still be used independently of devise. This also achieves omniauth support for multiple models.

How it works:

* keep omniauth as is, don't force specific path
* use extra controller (Devise::OmniauthAuthorizeController) to prepare request to omniauth, i.e. store resource name in session, then redirect to omniauth
* use routing constraints to route the callback to the correct omniauth callback controller

So for developers implementing the callbacks nothing really changes, just testing the callback controller in isolation becomes a bit more tricky because you'll need to set the resource name in the session.

Notes:

* would like to remove the extra redirect to omniauth, but I couldn't figure out a good way.
* need to find a better way to remove the resource name from the session to avoid potential issues when using omniauth without devise.