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

DimZ's avatar
Level 4

Fortify: verify email without being authenticated

Hi guys,

I'm still having some issues with Sanctum/Fortify, it seems a little bit complicated when you want customize it.

I'm trying to implement the email verification process with Fortify, and I would like make some changes.

I want to customize the email template. I tried to create a blade template in resources/view/auth/verify.blade.php, but it doesn't work.

Because I will have a mobile app (and a SPA), I want to verify email address without being authenticated. However, I cannot change the middleware used by Sanctum, especially for the verification.verify route.

I'm a little bit lost.

Well, thank you for your help !

0 likes
4 replies
DimZ's avatar
Level 4

Hello @raidboulahdid, I finally gave up Fortify and implemented my own auth auth/verification process. It took me 2 days. That was finally simpler/shorter to code everything by myself than trying a way to do that with Fortify.

maximos's avatar

Same problem, I'm exhausted and don't understand how to solve it. Users register, then follow the link in the email to confirm their email and can open it in a different browser than the one they registered in and are already authorized in. And Laravel redirects to the login page instead of just confirming the email. The middleware Illuminate\Auth\Middleware\Authenticate is triggered, which redirects to the login page, since I am supposedly not authorized. I have all the default settings for auth and fortify.

maximos's avatar

I solved it by added this code to FortifyServiceProvider:

Authenticate::redirectUsing(function(Request $request) {
    if ($request->routeIs('verification.verify')) {
        Auth::loginUsingId($request->route('id'));

        return route('verification.verify', [
            'id' => $request->route('id'),
            'hash' => $request->route('hash'),
            'expires' => $request->query('expires'),
            'signature' => $request->query('signature')
        ]);
    }
});

Please or to participate in this conversation.