Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

465
Visualizações
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.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

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.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda