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

Burano's avatar

Laravel Fortify not triggering 2FA challenge?

I've used Laravel Fortify to write some authentication for my app and I've setup the enable part of the 2FA, and that all works fine, but the problem I'm having is that it doesn't seem to trigger the challenge when a user logs in?

I've setup the custom view like so;

        Fortify::twoFactorChallengeView(function () {
            return view('auth.two-factor-challenge');
        });

and Fortify claims it should "...automatically redirect the user to your application's two factor authentication challenge screen." (https://laravel.com/docs/9.x/fortify#authenticating-with-two-factor-authentication), but this is not the case for me, it doesn't redirect at all.

Can't seem to find any sort of Middleware in the source-code to manually achieve this, so was wondering if someone might have an idea of what's going on?

I've manually checked my DB and all the two factor columns such as two_factor_secret are set correctly after enabling, so I'm a bit confused.

In my fortify config, I've got the below set since I don't want to confirm password and instead confirm the current OTP code for any changes that need to be made since that is what makes the most sense for my app I think. Not sure if disabling confirmPassword would cause this though?

Features::twoFactorAuthentication([
            'confirm' => true,
            'confirmPassword' => false,
        ]),
0 likes
4 replies
cardei's avatar

Hi, I have the same issue. My app is using AuthenticatesUsers trait. I managed to implement the enable/disable 2AF part but when I login is not triggering 2FA challenge.

Maybe somebody can help us with this issue. Thanks!

1 like
umairge66's avatar

Hi I have found a solution which is working fine.

When you do post request and see the response of request it will return:

{"two_factor":true}

So make a check if two_factor == true then show two factor challenge page. This is the best solution as there is no other solution.

Christofer's avatar

Same here. Laravel 10, Fortify, + Two Factor Auth Can login, but never shows the 2FA form. Debugging shows that it's enabled. Just that there is no clear code to show where it is checking (after successful login), where it's redirecting, why it is not redirecting to 2FA form.

PS: this is after installing Jetstream, and removing Jetstream, reinstalling Fortify

Please or to participate in this conversation.