we are calling https://demo.com/auth/session in next js application
backend team set the response cookie as secure HttpOnly cookie
const session = await (
await fetch(
`https://demo.com/auth/session`,
requestOptions
)).json();
console.log("cookies",ctx?.req?.headers?.cookie);
backend cookies code
Set-Cookie: id=a3fWa; Expires=Thu, 21 Oct 2021 07:28:00 GMT; Secure; HttpOnly
how can we access secure HttpOnly cookie in next js application
You cant access HttpOnly cookie by using client side JavaScript. It is intended to be like that because of security(to prevent some type of attacks).
Please use it as a reference https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies