Reputation: 10882
I read a few other questions similar to this but wasn't able to find a satisfactory answer, so just asking again with what I have done in my code so far.
in resources/assets/bootstrap.js I have
window.Echo = new Echo({
broadcaster: 'pusher',
key: '8c5cc1d9fe77464ac2df',
cluster: 'us2',
encrypted: true,
authEndpoint: '/chat4/public/authenticate-broadcasting',
});
and in my routes/web.php I have:
Route::post('/authenticate-broadcasting', function () {
return true;
});
but when I load the application page, in console I get:
POST http://laraveldemo-one.com/chat4/public/authenticate-broadcasting 500 (Internal Server Error)
Pusher : Couldn't get auth info from your webapp : 500
I installed Laravel Echo and Pusher correctly because if I use public channels, my application works perfectly, but I'm failing miserably using private channels, I'm not sure what else I can try as I have read thru the documentation a few times and can't find anything I'm missing. Help me please! :)
Upvotes: 0
Views: 4338
Reputation: 36
You must send csrf_token You can send via meta tags or in Echo json parameter with auth: { headers: { 'X-CSRF-Token': 'some_csrf_token' } }
https://pusher.com/docs/client_api_guide/client_connect
Upvotes: 2