title: Laravel 4 : User not staying Logged In
body: <p>My user authentication broke after I upgraded Laravel to 4.1 from 4.0.</p>
  
  <p>I followed the Upgrade Guide provided by the documentation.</p>
  
  <p>Now, when I login, it seems only to last for one request.</p>
  
  <p>For example, in my HomeController index method, I force login like so:</p>
  
  <pre><code>Auth::login(User::find(1), true);
  $user = Auth::user();
  return View::make('layout', array('user' =&gt; $user));
  </code></pre>
  
  <p>I echo $user on the layout and it displays the user information perfectly.</p>
  
  <p>However, if I modify the controller by simply removing the first line that uses Auth to login and then refresh the page, it's blank.</p>
  
  <p>EDIT</p>
  
  <p>I am using Confide 3.1.0 for user authentication and here is the do_login() function. I have done a die &amp; dump immediately inside of the first 'if' to confirm that Confide::logAttempt is returning true.</p>
  
  <p>I have also completely hidden that entire block and simply done a 'echo Auth::user()' and it does in fact return the User model for the user I just logged in as.</p>
  
  <pre><code>public function do_login()
  {
      $input = array(
          'email'    =&gt; Input::get( 'email' ), // May be the username too
          'username' =&gt; Input::get( 'email' ), // so we have to pass both
          'password' =&gt; Input::get( 'password' ),
          'remember' =&gt; Input::get( 'remember' ),
      );
      // If you wish to only allow login from confirmed users, call logAttempt
      // with the second parameter as true.
      // logAttempt will check if the 'email' perhaps is the username.
      // Get the value from the config file instead of changing the controller
  
      if ( Confide::logAttempt( $input, Config::get('confide::signup_confirm') ) )
      {
          // Redirect the user to the URL they were trying to access before
          // caught by the authentication filter IE Redirect::guest('user/login').
          // Otherwise fallback to '/'
          // Fix pull #145
          return Redirect::intended('/'); // change it to '/admin', '/dashboard' or something
      }
      else
      {
          $user = new User;
  
          // Check if there was too many login attempts
          if( Confide::isThrottled( $input ) )
          {
              $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
          }
          elseif( $user-&gt;checkUserExists( $input ) and ! $user-&gt;isConfirmed( $input ) )
          {
              $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
          }
          else
          {
              $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
          }
  
                      return Redirect::action('UserController@login')
                          -&gt;withInput(Input::except('password'))
              -&gt;with( 'error', $err_msg );
      }
  
  }
  </code></pre>
  
  <p>Here is the logAttempt() function</p>
  
  <pre><code>public function logAttempt( $credentials, $confirmed_only = false, $identity_columns = array() )
  {
      // If identity columns is not provided, use all columns of credentials
      // except password and remember.
  
      if(empty($identity_columns))
      {
          $identity_columns = array_diff(
              array_keys($credentials),
              array('password','remember')
          );
      }
  
      // Check for throttle limit then log-in
      if(! $this-&gt;reachedThrottleLimit( $credentials ) )
      {
          $user = $this-&gt;repo-&gt;getUserByIdentity($credentials, $identity_columns);
  
          if(
              $user &amp;&amp;
              ($user-&gt;confirmed || ! $confirmed_only ) &amp;&amp;
              $this-&gt;app['hash']-&gt;check(
                  $credentials['password'],
                  $user-&gt;password
              )
          )
          {
              $remember = isset($credentials['remember']) ? $credentials['remember'] : false;
  
              $this-&gt;app['auth']-&gt;login( $user, $remember );
              return true;
          }
      }
  
      $this-&gt;throttleCount( $credentials );
  
      return false;
  }
  </code></pre>