I am writing a one-page web application.
I use Vue.js in the interface and Laravel in the backend.
I have enabled Passport Token Authentication, and I get an Authentication Token Transfer
var login_data = { client_id : 2, client_secret : "SECRET_KEY", grant_type : "password", username : "mail", password : "pass" }
To this endpoint of the passport is http: // IPADDRESS / oauth / token . Then I authenticate my AJAX requests, including this header
{ 'Authorization': 'Bearer ' + ACC_TOKEN }
In most cases, everything works fine, but sometimes I get 401 unauthorized . Usually, if I just do it again, the request passes.
I removed the VerifyCsrfToken from Kernel.php and also added an API route to the exceptions, so I don't think the problem is.
The frequency of the error seems to vary from network to network, that is, when connected to certain networks, it almost never occurs, sometimes it is constant.
I honestly have no idea why this is happening.