Messenger-App-VueJS-and-Laravel
Messenger-App-VueJS-and-Laravel copied to clipboard
broadcasting-auth-always-fails-with-403-error
403 error auth broadcasting. I think it needs some kind of authentication for private channel. how can i do that?
try this: `<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { Broadcast::routes(['middleware' => ['auth:api']]);
require base_path('routes/channels.php');
}
}` in broadcast service provider
@gabriel-rumajar Make sure you subscribe to the correct channel with Echo
and you have the proper route in routes/channels.php
in there to listen.
It's often a matter of a typo.
I ran into this issue and specifying the auth:API middleware worked. So yayy! But why?