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

Bilal_swl's avatar

How can I redirected back user to their intended page after login in a Laravel 11 application using Jetstream?

I’ve explored numerous blogs on how to redirect users back to their intended page after login in a Laravel application using Jetstream, but I’m still looking for a clear and definitive solution. I need a comprehensive guide or best practice to ensure that the redirection works flawlessly every time.

0 likes
3 replies
Snapey's avatar

Redirecting to Intended is already the default behaviour?

    public function toResponse($request)
    {
        return $request->wantsJson()
                    ? response()->json(['two_factor' => false])
                    : redirect()->intended(Fortify::redirects('login'));
    }

To understand how intended works;

  • user is not logged in
  • authentication intercepts their access to a route protected by auth
  • they enter login details, are authenticated and are sent to the route they were trying to reach
1 like

Please or to participate in this conversation.