mercredi 1 août 2018

Intermittent 419 during broadcast/auth | Laravel Echo

I am receiving - intermittently - a 419 error upon refreshing a Laravel 5.6 / Vue app. The error appears with the AJAX to /broadcasting/auth to get authentication from my channels.php code - as a result I do not connect to the channel, and some JS fails (as expected).

The same code works 95% of the time, and if I get the error I just refresh (sometime 3 or 4 times) and it will work.

The channels.php auth is wide open for both the public and presence channels I connect to.. meaning I just return TRUE with no checking.

I understand a 419 error has to do with the CSRF, but why would it work by refreshing? And what could happen to it that I could fix to prevent it.

I suspected a timeout, but it can be 30sec, or 15 minutes - time has no factor.

I am at a loss to post code, as it is the base code as shipped so here is my setup

WAMP on Windows with PHP 7.2
Laravel 5.6
Echo through Pusher (service)

tested from Google, Safari, Firefox, Canary (all browsers have same issue)

I am assuming Axios is used for ajax, but, again it is the internal app.js / NPM compilation so I am not sure.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire