httponly cookie not store the browser

43 views Asked by At
  • login service running in linux server
  • reactjs appilication is running in localhost
  • login service return httponly cookie not store the browser in local reactjs appilication

React js: axios used enable withcredentials true include login service call

export async function LoginPostRequest(body: any, params: any) {
  console.log("PostRequest");

  const customConfig = {
    headers: {
      "Content-Type": "application/json",
    },
  };
  // add relative_url
  body.relative_url = params.apiurl;
  const response = await axios.post(
    `${WEB_APIGATEWAY_SERVICE_URL}/${params.apiurl}`,
    body,
    {
      withCredentials: true,
    }
  );
  return response;
}

Nestjs: login service return the http-only cookie code:

 res.cookie("access_token", user.access_token, {
       httpOnly: true,
       sameSite: "none",
       secure: false,
       maxAge: 7 * 24 * 60 * 60 * 1000, // 7 days
      });
0

There are 0 answers