Logging a User In Without Sessions or Cookies


You want to log a user in without using cookies or the session.


Use the Auth::once() method.

This method takes an array containing the user's credentials.

$logged_in = Auth::once(['username' => 'test', 'password' => 'test']);
if ( ! $logged_in)
    throw new Exception('not logged in');


The user will remain "logged in" only for the current request.

This is a handy method to use when testing.

comments powered by Disqus