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

349
Views
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 answers
Answer question

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 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!