Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

parrots's avatar

Session driver error with JWT

I'm trying to integrate the JWT package into Laravel. I have all the built-in auth stuff working in Laravel 5.1, but when I go to auth by the default examples it looks like there is some kind of error deep in the bowls of Laravel trying to initialize the session driver that'd back the authentication manager..

ErrorException in Manager.php line 77:
Missing argument 1 for Illuminate\Support\Manager::createDriver(), called in /Users/parrots/Documents/Consumed by Code/Slopes/Server/vendor/laravel/framework/src/Illuminate/Support/Manager.php on line 87 and defined
in Manager.php line 77
at HandleExceptions->handleError('2', 'Missing argument 1 for Illuminate\Support\Manager::createDriver(), called in /Users/parrots/Documents/Consumed by Code/Slopes/Server/vendor/laravel/framework/src/Illuminate/Support/Manager.php on line 87 and defined', '/Users/parrots/Documents/Consumed by Code/Slopes/Server/vendor/laravel/framework/src/Illuminate/Support/Manager.php', '77', array('this' => object(SessionManager))) in Manager.php line 77
at Manager->createDriver() in Manager.php line 87
at Manager->createDriver(null) in Manager.php line 63
at Manager->driver() in SessionServiceProvider.php line 48
at SessionServiceProvider->Illuminate\Session\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('session.store', array()) in Application.php line 674
at Application->make('session.store') in Container.php line 1157
at Container->offsetGet('session.store') in /Users/parrots/Documents/Consumed by Code/Slopes/Server/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php line 93
at AuthManager->createEloquentDriver() in /Users/parrots/Documents/Consumed by Code/Slopes/Server/vendor/laravel/framework/src/Illuminate/Support/Manager.php line 87
at Manager->createDriver('eloquent') in AuthManager.php line 18
at AuthManager->createDriver('eloquent') in Manager.php line 63
at Manager->driver() in Manager.php line 137
at Manager->__call('once', array(array('email' => 'xxx', 'password' => 'xxx'))) in IlluminateAuthAdapter.php line 31
at AuthManager->once(array('email' => 'xxx', 'password' => 'xxx')) in IlluminateAuthAdapter.php line 31
at IlluminateAuthAdapter->byCredentials(array('email' => 'xxx', 'password' => 'xxx')) in JWTAuth.php line 99
at JWTAuth->attempt(array('email' => 'xxx', 'password' => 'xxx')) in Facade.php line 210
at Facade::__callStatic('attempt', array(array('email' => 'xxx', 'password' => 'xxx'))) in AuthenticateController.php line 21
at JWTAuth::attempt(array('email' => 'xxx', 'password' => 'xxx')) in AuthenticateController.php line 21
at AuthenticateController->signin(object(Request))

Unfortunately I'm a bit new to Laravel so I have no idea how to begin debugging this. I so have a session driver set up (file) and I have verified that sessions are being created when using the normal web-based auth. The JWT config is unchanged aside from the namespace of the backing model changing.

As best I can tell this is all code beyond my control, but I'm not ruling out having messed something up along the way. I'm not seeing any bug reports against JWT, or anyone else complaining about this error.

Any guidance would be appreciated.

0 likes
1 reply
parrots's avatar

I'm an idiot -- it's because I had disabled my session driver for the API path.

What do others do for stateless APIs to keep using the built-in auth system, but avoid storing sessions somewhere?

Please or to participate in this conversation.