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

348
Visualizações
axios doesn't store cookie but in response is setCookie=.... Access-Control-Allow-Credentials and withCredentials php - laravel

i wanna get passport cookie in react.js i fixed all of thing in .htaccess and i can get the cookie with javascript

but it isn't store in browser storage

 cookie is here but didn't store

this is my code in front with axios

.htaccess

  Header set Access-Control-Allow-Origin "http://localhost:3000"
 Header set Access-Control-Allow-Credentials  "true"
    Header set Access-Control-Allow-Headers "Access-Control-Allow-Credentials,Access-Control-Allow-Headers,Access-Control-Allow-Origin"
   

react.js

axios.get("http://domin.com/JwtCookie", {
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
        },

        withCredentials: true,
    }).then(re => console.log(re)).catch()

i try it with another cookie but there is this problem too

thanks ...

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The CORS headers Access-Control-Allow-... are not request headers, they are response headers so you should set them on the response.

Also, you need to set the Samesite=None attribute on the cookie. After that, your cross-domain cookie will be sent by the browser.

about 4 years ago · Juan Pablo Isaza 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