F
Filament3mo ago
MikeG

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]]);
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,
});
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
Jump to solution
4 Replies
MikeG
MikeG3mo ago
Has anyone faced this issue before? Still an issue im facing
ModestasV
ModestasV3mo ago
Why you don't use Filament echo provider?
MikeG
MikeG2mo ago
I need it outside of filament but i need it to hook in to the authentication part of filament
Solution
MikeG
MikeG2mo ago
Seems the fix is to set broadcasting route middelware to web instead of the guard
Want results from more Discord servers?
Add your server
More Posts