使用omniauth gem,无论提供者如何,我都被迫为成功登录定义单个路由回调:
def auth_callback
auth_data = request.env['omniauth.auth']
if auth_data.has_key('something')
process_one(auth_data)
else
process_two(auth_data)
end
# No view is available here
end
def process_one
# do something then render view for process_one
return
end
def process_two
# do something then render view for process_two
return
end
Run Code Online (Sandbox Code Playgroud)
如何防止控制器返回到auth_callback方法并尝试显示相应的视图(不存在)?一旦process_one或process_two方法返回,则应将处理视为完成.