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

Brand3000's avatar

Laravel Nova and separate website authorization

Hello!

I want to divide users of Nova and my website. For this purpose I've done several changes in the config/auth.php file:

added the new guard:

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

added the new provider:

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Models\User::class,
        ],
        'admins' => [
            'driver' => 'eloquent',
            'model' => App\Models\Admin::class,
        ],
    ],

added the new passwords setting:

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_reset_tokens',
            'expire' => 60,
            'throttle' => 60,
        ],
        'admins' => [
            'provider' => 'admins',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 0,
        ],
    ],

and changed two settings in the .env file:

NOVA_GUARD="admins"
NOVA_PASSWORDS="admins"

All but one issue works fine: If I login as a users through the 'users' setting on my website and then return to Nova and try to submit any form, I get the error message: "Sorry, your session has expired. RELOAD". I have to just refresh Nova and it works. But it's inconvenient.

Is there a way in existence to force it works perfectly without this error? Thanks.

0 likes
0 replies

Please or to participate in this conversation.