# File lib/omniauth/strategy.rb, line 29
    def call!(env)
      raise OmniAuth::NoSessionError.new("You must provide a session to use OmniAuth.") unless env['rack.session']

      @env = env
      @env['omniauth.strategy'] = self      
      
      return mock_call!(env) if OmniAuth.config.test_mode
      
      if current_path == request_path && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
        setup_phase                  
        if response = call_through_to_app
          response
        else
          if request.params['origin']
            @env['rack.session']['omniauth.origin'] = request.params['origin']            
          elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
            @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
          end
          request_phase
        end
      elsif current_path == callback_path
        setup_phase                  
        @env['omniauth.origin'] = session.delete('omniauth.origin')
        @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''

        callback_phase
      else
        if respond_to?(:other_phase)
          other_phase
        else
          @app.call(env)
        end
      end
    end