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

120
Views
Axios not sending previously set cookies between requests

We have the following code:

const defaultOptions = {
  baseURL: process.env.REACT_APP_CRIPTOCAMBIOS_URL,
  headers: {
    'Content-Type': 'application/json'
  }
};
export const CCApi = axios.create(defaultOptions);

export const requestDomicileAutocomplete = input =>
  CCApi.post(
    '/domicile_seeds/autocomplete',
    { input, types: ['address'] },
    { withCredentials: true }
  );

// FIXME: Review sending cookies in the payload, we probably need to add { withCredentials: true } in both requests. I am getting a CORS issue right now. So skipping it.
export const requestDomicileDetail = placeId =>
  CCApi.post(
    '/domicile_seeds/place_details',
    {
      place_id: placeId,
      fields: 'address_components'
    },
    { withCredentials: true }
  );

We have CORS enabled, so we had to make some changes to our server to pass browser checks.

The server does the following:

  1. On the first request to /autocomplete, it sets a cookie.
  2. On the second request to /place_details, it expects the cookie to be set, and cleans it up.

However, we noticed that on the request to /place_details we don't receive the cookie.

And this is what we see in the dev tools.

Autocomplete cookies:

enter image description here

Place details cookies:

enter image description here

So as you see, in the request to /place_details its not sending in the request the previously set Cookie.

What are we doing wrong? We are using axios v0.21.4

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