Skip to content

Instantly share code, notes, and snippets.

@patbenatar
Created October 16, 2012 17:38
Show Gist options
  • Select an option

  • Save patbenatar/3900776 to your computer and use it in GitHub Desktop.

Select an option

Save patbenatar/3900776 to your computer and use it in GitHub Desktop.
After oauth login, return user to URL they came from with Devise + Omniauth
# link_to path
user_omniauth_authorize_path(:facebook, origin: request.fullpath)
# in ApplicationController
def after_sign_in_path_for(resource)
stored_location_for(resource) || request.env['omniauth.origin'] || root_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment