Visanduma / nova-two-factor

Laravel nova in-dashboard 2FA feature
54 stars 31 forks source link

InvalidArgumentException View [app] not found. #42

Closed michelschilder closed 1 year ago

michelschilder commented 1 year ago

When I add ( /config/nova.php )

'middleware' => [                
    \Visanduma\NovaTwoFactor\Http\Middleware\TwoFa::class        
],

any request is redirecting to /admin/login with the following error:

InvalidArgumentException View [app] not found. http://127.0.0.1:8000/admin/login

By disabling the middleware in /config/nova.php it works again, but of course without 2fa enabled.

2fa (enable/disable) page in nova is working fine though.

What am I doing wrong?

michelschilder commented 1 year ago

When I add 'web' to the middleware, I get one step closer and can fill in the 2fa-string.

'middleware' => [
'web', \Visanduma\NovaTwoFactor\Http\Middleware\TwoFa::class
],

After that it's redirecting to 'nova-vendor/nova-two-factor/authenticate' with an 403 forbidden.

lahirulhr commented 1 year ago

It's looks like 2FA middleware conflict with another one. Could you share the full error message with the file name and line numbers?

michelschilder commented 1 year ago

FIXED

I created a new plain laravel project, with nova and the two-factor. And it does work!

I saw some differences in the /config/nova.php file.

With these in the config it does work. Also in my existing project now.

'middleware' => [
    'web',
    HandleInertiaRequests::class,
    DispatchServingNovaEvent::class,
    BootTools::class,
    \Visanduma\NovaTwoFactor\Http\Middleware\TwoFa::class
],

'api_middleware' => [
    'nova',
    Authenticate::class,
    Authorize::class,
],
lahirulhr commented 1 year ago

I am glad to know that you found a way to solve the issue