I have generated and set cookie at frontend itself (React JS) using js-cookie library which was working fine until I was using it with httpOnly set as false. Now, my condition is set httpOnly as true but I'm not able to achieve this because I found on internet that if we will set the cookie with httpOnly = true then I will not able to get the cookie using javascript (viz. React JS) which is just a feature of httpOnly cookie.
- I searched and found one related library called "react-cookie" can be found https://www.npmjs.com/package/react-cookie but with this library also I don't know how my javascript will able to get the cookie.
- Also, I found somewhere that we can use express server as middleware between actual processing server and we can set and get our secured cookie at express server but I would be large task to switch at this stage.
Can anyone suggest me some other better approach to set and get my cookie with httpOnly set as true using react js. All the suggestions are welcomed! Thanks in advance.