Laravel /broadcasting/auth Always Fails With 403 Error

后端 未结 8 2147
时光取名叫无心
时光取名叫无心 2021-01-04 03:58

I have recently delved into Laravel 5.3\'s Laravel-Echo and Pusher combination. I have successfully set up public channels and moved on to private ones. I am having trouble

8条回答
  •  长情又很酷
    2021-01-04 04:31

    I paired socket.io with redis and also had a problem with 403 error, even though there weren't any authentication middlewares over /broadcasting/auth route. Only after whatching laracasts lesson I figured out that just channel authorization is not enough, there always should be user and no matter how you authenticate and obtain user, using default laravel auth or some token algorithm - jwt or anything else.

    Authenticated user is automatically resolved and passed as first parameter to to closures functions in routes/channels.php file, so you can check channel availability for currently logged in user

提交回复
热议问题