tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 512 forks source link

could not be authenticated to presence-chats-channel (Client can not be authenticated, got HTTP status 403) #505

Open umairali opened 4 years ago

umairali commented 4 years ago

Everything was working fine but when i try to run

laravel-echo-server start

from supervisor below error appear.

[11:25:15 PM] - zmMtehwMctWVHxFBAAAB joined channel: chats-channel
[11:25:16 PM] - Preparing authentication request to: https://domain.com
[11:25:16 PM] - Sending auth request to: https://domain.com/broadcasting/auth

⚠ [11:25:16 PM] - zmMtehwMctWVHxFBAAAB could not be authenticated to presence-chats-channel

Client can not be authenticated, got HTTP status 403
enbacode commented 4 years ago

Are you using sanctum? I have the same problem since I switched from JWT to sanctum.

umairali commented 4 years ago

I solved this issue by removing the below code from the vue component.

Echo.join(chat.${roomId}) .here((users) => { // }) .joining((user) => { console.log(user.name); }) .leaving((user) => { console.log(user.name); });

pintoflager commented 4 years ago

If you're using Sanctum try setting up the middleware for the broadcasting routes in Providers/BroadcastServiceProvider: Broadcast::routes([ 'prefix' => 'api', 'middleware' => ['api', 'auth:sanctum'] ]);

Stackedwisdom commented 2 years ago

I solved this issue by removing the below code from the vue component.

Echo.join(chat.${roomId}) .here((users) => { // }) .joining((user) => { console.log(user.name); }) .leaving((user) => { console.log(user.name); });

Hi @umairali, can you please expound on your solution? May I know the version of your Laravel?

thanks