Reputation: 1149
i have realtime application in nuxt and laravel with laravel-echo-server
when i use this
window.Echo.channel(`laravel_database_test-channel`).listen(
"TestEvent",
e => {
console.log(e);
}
);
everything works fine
but when i try in private channel like this
window.Echo.private(`laravel_database_test-channel`).listen(
"TestEvent",
e => {
console.log(e);
}
);
getting error "message": "CSRF token mismatch."
here is full screenshot
Upvotes: 0
Views: 1391
Reputation: 1149
goto App\Providers\BroadcastServiceProvider modify this
Broadcast::routes();
to
Broadcast::routes(['prefix' => 'api', 'middleware' => ['auth:api']]);
and in your laravel-echo-server.json
edit this
"authEndpoint": "/api/broadcasting/auth",
this helps me and working fine
Upvotes: 4