Thanks for your good package, I'm using laravel as backend API (with passport package) and I have some issues with your package, please help me to solve this. let me explain it to you:
I have laravel as backend in the localhost:8000 domain and have a nuxtJS project in the localhost:3000. I'm making a login request from nuxt application to laravel with Axios and save user tokens in cookies.
now when I want to subscribe to private or presence channel I get 401 and it's because of that I cannot set the header for broadcasting/auth endpoint. remember I saved user token in browser cookies.
in nuxt.config.js file i have these options for echo:
echo: {
broadcaster: 'pusher',
host: '127.0.0.1:6001',
wsHost: '127.0.0.1',
wsPort: 6001,
key: process.env.MIX_PUSHER_APP_KEY,
cluster: 'mt1',
forceTLS: false,
encrypted: false,
disableStats: true,
authEndpoint: 'http://127.0.0.1:8000/broadcasting/auth',
auth: {
headers: {
Authorization: `Bearer ${cookies.get('user_token')}` // i'm using js-cookie package to works with cookies
}
}
},
And in Laravel:
in BroadcastServiceProvider:
public function boot()
{
Broadcast::routes(['middleware' => 'auth:api']);
require base_path('routes/channels.php');
}
in my event file:
public function broadcastOn()
{
return new PresenceChannel('user.messages.chat.' . $this->user_id);
}
Hi
Thanks for your good package, I'm using laravel as backend API (with passport package) and I have some issues with your package, please help me to solve this. let me explain it to you:
I have laravel as backend in the
localhost:8000
domain and have a nuxtJS project in thelocalhost:3000
. I'm making a login request from nuxt application to laravel with Axios and save user tokens in cookies.now when I want to subscribe to private or presence channel I get 401 and it's because of that I cannot set the header for
broadcasting/auth
endpoint. remember I saved user token in browser cookies.in
nuxt.config.js
file i have these options for echo:And in Laravel:
in BroadcastServiceProvider:
in my event file:
in controller file:
in routes/channel.php:
But it's RETURN 401.
are you can help me to solve this issue?