Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda