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:
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:
Place details cookies:
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