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

tijan's avatar
Level 1

Use both Session and JWT Auth in Laravel 5.5

Hello, I am using Laravel 5.5 with JWT dev-develop. I have also set my auth drivers for web.

'defaults' => [
    'guard' => 'web',
    'passwords' => 'users',
],

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'jwt',
        'provider' => 'users',
    ],
],

But, the above configuration doesn't give me JWT Bearer Token. When I replace web with api, Auth::attempt($credentials) gives me JWT token instead of session.

Any ideas how to use both at the same time?

0 likes
3 replies
ijin82's avatar

Did you found any solution for this?

tijan's avatar
Level 1

The above configuration works for me. I messed up a little that time, but works fine now :)

damilare_koiki's avatar

@tijan Please, can you give a detailed explanation of how you solved this issue, from the configuration to how you handled the login.

Please or to participate in this conversation.