Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

czepter's avatar

Laravel Echo / Broadcast private Channels not working with Laravel9 & JWT Auth

Hi!

i am stuck after 8h of various debugging -.-

I am using Laravel 9 with php-open-source-saver/jwt-auth to power a nuxt3 frontend - works fine To simplify cross-device usage I try to integrate Laravel Broadcasting with Pusher (or better with soketi) and this is also working fine with pusher-js and laravel/echo while listening public channels - as soon as I switch to private channels the routes for /broadcast/auth and all its magic are not working... i followed and tried https://medium.com/js-dojo/laravel-passport-pusher-vue-js-27fcec38546b but no success... additionally i wrapped laravel/echo with an additional authorizer similar to https://github.com/laravel/echo/issues/360

neither echo nor pusher-js are working since the /broadcast/auth url returns a 404 skipping this by writing an own auth handler leads to a successfull auth result but then the channel subscription does not work

relying on laravel BroadcastServiceProvider + private channel via laravel/echo

...
class BroadcastServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Broadcast::routes([
            'middleware' => 'auth:api',
            'prefix' => 'api'
        ]);

        require base_path('routes/channels.php');
    }
}

result: The route api/broadcast/auth could not be found.

custom auth + private channel via laravel/echo

{
  "event": "pusher:subscription_error",
  "channel": "private-b16yz802-status",
  "data": {
    "type": "AuthError",
    "error": "The connection is unauthorized.",
    "status": 401
  }
}
0 likes
5 replies
christian-qode's avatar

Have you cleared the route cache? Is the route available when you run php artisan route:list?

And.. have you included the BroadcastServiceProvider in your config/app.php file? (by default it's outcommented).

czepter's avatar

hi @christian-qode,

yes - route cache is cleared and route:list is showing the correct route

GET|POST|HEAD     api/broadcasting/auth ...... Illuminate\Broadcasting › BroadcastController@authenticate

same for the config/app.config --> App\Providers\BroadcastServiceProvider::class is not commented out

christian-qode's avatar
Level 8

@czepter The route is api/broadcasting/auth, error says The route api/broadcast/auth could not be found

I think that's the problem :)

1 like
czepter's avatar

@christian-qode

nevermind - overlooked that tiny bit -.- thanks for opening my eyes!

christian-qode's avatar

@czepter Annoying things.. I also didn't saw it immediately ;)

Glad it works now, can you mark the best answer please?

Please or to participate in this conversation.