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

uniqueginun's avatar

Inertia redirect to external SSO login service for protected routes

Hello,

I have this issue in my inertia app when guests trying to access protected routes and laravel redirects them but I get CORS issue. how to fix that

class Authenticate extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return string|null|Redirect
     */
    protected function redirectTo($request)
    {
        return "https://externalssoservice.com?someparams";
    }
}
0 likes
0 replies

Please or to participate in this conversation.