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

122
Visualizações
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 à 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