Laravel Echo failing on broadcast auth

Hey everyone,

Running in to an issue with using laravel echo in a custom page through filament.

The jist of it is that it's currently failing the /broadcast/auth call.

I've added the following configuration to my BroadcastServiceProvider

Broadcast::routes(['middleware' => [InitializeTenancyByDomainOrSubdomain::class, Authenticate::class]]);


The Authenticate::class is coming from Filament\Http\Middleware\Authenticate. This will result in a 302 redirect to login from the broadcasting auth endpoint.

If I remove that entirely it will result in a 403 Forbidden.

I've tried adding 'auth' to the middleware but this also results in 302

I'm assuming I'm doing something wrong here related to what authentication middleware I should be using but I'm not entirely sure

Here is the code where I'm setting Echo:
window.Echo = new Echo({
    broadcaster: 'pusher',
    key: import.meta.env.VITE_PUSHER_APP_KEY,
    cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,
    forceTLS: true,
});


It's connecting to Pusher properly, just failing the auth
Solution
Seems the fix is to set broadcasting route middelware to web instead of the guard
Was this page helpful?