This repository has been archived by the owner on Apr 24, 2021. It is now read-only.
forked from omniauth/omniauth
-
Notifications
You must be signed in to change notification settings - Fork 0
Saving User Location
jjb edited this page May 31, 2011
·
3 revisions
One of the more common things required of an authentication system is
the ability to send the user back where they came. OmniAuth will
automatically keep track of the HTTP_REFERER
when you begin the
authentication process, and will provide it to you in the callback phase
as the omniauth.origin
key in the environment hash. To use this,
you would simply modify your callback action to redirect to the origin
if it is already set:
class SessionsController < ApplicationController
def callback
# do your authentication stuff here...
redirect_to request.env['omniauth.origin'] || '/default'
end
end
How convenient!
You can also customize the return URL by providing the origin
query parameter in your initial omniauth URL:
/auth/twitter?origin=%2Fusers%2Fshow%2F24
User Docs
- List of Strategies
- Frequently Asked Questions
- Help Topics
- External Resources
- Upgrading to 1.0
- Auth Hash Schema
Strategy Developers
Project Resources