Messenger-App-VueJS-and-Laravel icon indicating copy to clipboard operation
Messenger-App-VueJS-and-Laravel copied to clipboard

broadcasting-auth-always-fails-with-403-error

Open gabriel-rodin opened this issue 5 years ago • 3 comments

authbroadcast

403 error auth broadcasting. I think it needs some kind of authentication for private channel. how can i do that?

gabriel-rodin avatar Mar 13 '19 09:03 gabriel-rodin

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

HumamAlb avatar May 20 '19 19:05 HumamAlb

@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.

AfikDeri avatar May 27 '19 18:05 AfikDeri

I ran into this issue and specifying the auth:API middleware worked. So yayy! But why?

evelynDickinson avatar Apr 01 '21 20:04 evelynDickinson