Wednesday, March 6, 2013

Saving User Location · intridea/omniauth Wiki · GitHub

Customizing the callback of an OAuth request using Omniauth is pretty simple.  In you sessions controller where you save the OAuth token, simply add a redirect to omniauth.origin or some other desired destination.  omniauth.origin saves the user's  last location using the http_referrer.

class SessionsController < ApplicationController
  def callback
    # do your authentication stuff here...
    redirect_to request.env['omniauth.origin'] || '/default'
I ended up setting the origin in my urls directly.