Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

453
Views
Laravel and Passport, random 401 errors

I'm writing a single page web application.

I'm using Vue.js in the frontend and Laravel in the backend.

I included Passport token authentication and I'm getting the auth token sending

var login_data = {
    client_id : 2,
    client_secret : "SECRET_KEY",
    grant_type : "password",
    username : "mail",
    password : "pass"
}

To this Passport endpoint http://IPADDRESS/oauth/token. Then I authenticate my AJAX requests including this header

{ 'Authorization': 'Bearer ' + ACC_TOKEN }

Most of the time everything works fine but sometimes I get 401 unauthorized. Usually, if I simply do it again the request goes through.

I removed the VerifyCsrfToken middleware from Kernel.php and also added the API route to the exceptions so I don't think that's the problem.

The frequency the error appears seems to change from network to network, meaning when connected to certain networks it almost never happens while sometimes it's constant.

I honestly have no idea why this happens.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

My problem was in PROJECTDIR/vendor/lcobucci/jwt/src/Signer/Rsa.php.

Here, an openssl function (openssl_get_publickey) sometimes returns something wrong even though the certificate is valid.

I failed to find a real solution.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!