DEV Community

loading...

Discussion on: Using laravel-echo with Nuxt.js

eichgi profile image
Hiram Author

For backend channeling authentication you would have to specify that you are using Laravel sanctum like this, given I am using the api prefix I put this in routes/api.php:

Broadcast::routes(['middleware' => ['auth:sanctum']]);

And taking this route as example it should works:

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int)$user->id === (int)$id;
});

I hope this is the answer you were looking for

Thread Thread
kp profile image
KP

@eichgi I’ll have to give it a go - thanks for responding!