Support the ongoing development of Laravel.io →
Authentication API Laravel
Last updated by @mora 2 years ago.
0

it seems that the header in echo is missing

Echo.connector.pusher.config.auth.headers['Authorization'] = 'Bearer token';

You can check below link for further details. https://github.com/tlaverdure/laravel-echo-server/issues/129#issuecomment-284216291

0

@skynet-technologies i dont use pusher and problem is no request is sent to the '/api/auth/custom', with header or not

0

The above code was an example which means, we have to pass a header with authentication(using bearer) You can check the below code and implement your code within it.

window.Echo = new Echo({
            broadcaster: 'socket.io',
            host: HOST_FOR_YOUR_SERVER,
            auth: {
                headers: {
                    Authorization: 'Bearer ' + AUTH_API_TOKEN,
                },
            },
        });

BroadcastServiceProvider:

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

For more reference, you can check the below URL https://github.com/laravel/framework/issues/23268#issuecomment-443986055

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Mora mora Joined 22 Jun 2022

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.