Open anwarx4u opened 4 years ago
Hi,
try Broadcast::routes(['middleware' => ['web']]);
.
Don't know why, but it helps for me.
@HalfBottleOfMind
Yea, I knew it will work!
Actually, "web" middleware does not check users' authentication. It works only on the public channel. that's why there have no 401/403 errors! But I have some broadcasting channel which is required authentication and authorization.
So, I need an authentication middleware which already mentioned at Laravel docx
@tlaverdure @taylorotwell
Can you help me regarding this, please
bump
Try: Broadcast::routes(['middleware' => ['api', 'auth:sanctum']]);
I have the same issue, have you got it working?
Edit:
I moved my Broadcast::routes(['middleware' => ['auth:sanctum']]);
to api.php
instead ofthe BroadcastServiceProvider
and it all works now.
Describe the bug Hi all, I am using the Sanctum SPA Authentication (CSRF protection) system for my application Authentication. It is working well. But I am unable to authenticate broadcasting.
The following process is being used:
Middleware :
Broadcast::routes(['middleware' => ['auth:sanctum']]);
laravel-echo-server.json
Bootstrap.js
import Echo from 'laravel-echo'; window.io = require('socket.io-client');
Error
laravel-echo-server start
I am getting the following errors where I run the above command
Am I doing something wrong? Please suggest me regarding this..
Thanks in advance.
Anwar