[Vuejs]-JSON data returns empty string when authorizing my channel

0👍

I have figured it out. To be honest, I dont know what the problem was, but its now working.

My channel is as follows:

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

-1👍

You should add user’s token to laravel echo headers.

headers: {
    'X-CSRF-Token': token.content,
    Authorization: `Bearer {token_here}`
}

Leave a comment