I want to redirect back to current page after oauth signin, and I followed this Devise wiki and did the following:
def after_sign_in_path_for(resource)
sign_in_url = new_user_session_url
if request.referer == sign_in_url
super
else
request.env['omniauth.origin'] || stored_location_for(resource) || request.referer || root_path
end
end
request.env['omniauth.origin']
is http://www.bubutravel.com/users/sign_in
stored_location_for(resource)
is nil
request.referer
is http://openapi.qzone.qq.com/oauth/[omitted] (my provider)
So after my omniauth login, I get redirected to the provider urls again.
Is the wiki outdated? What's the recommended way to do omniauth login redirect to current page?