Programatically setting cookies using javascript doesn't work on expired cookies
Hello, I will try to explain as best as I can.
In our web app, for authentication, we manually set our cookies (document.cookie = cookie) after receiving the tokens from the login request. We work with 2 cookies, 1 for the access and 1 to refresh the access one if it expires. The refresh cookie has a longer time to expire.
When we login on a fresh session with no cookies at all in the storage tab in the dev tools, all is fine. I actually tested this by setting a random cookie and then using the debugger to add a breakpoint on the very next line of code and then typing document.cookie in the console and it is present.
The problem appears when trying to login after the cookies expired. They are still present in the storage tab in the dev tools. Somehow, manually setting the cookies again doesn't actually set the cookies or it takes some time and our app is stuck on the login page because it doesn't pass our checks that it actually has the access cookie. Using the same test described above, re-setting a cookie that expired and using the debugger again to add a breakpoint on the very next line of code and then typing document.cookie in the console does not show the cookie.
This issue does not reproduce on other browsers and it started with version 116.0.3.
For a more step by step to reproduce the issue: 1. Use document.cookie = cookie with a expiry time of 20 seconds 2. Wait for 20 seconds to pass 3. Set the same cookie again 4. Use the debugger to set a breakpoint after setting the cookie 5. Type document.cookie in the console whilst in the breakpoint pause 6. The cookie doesn't show in the document.cookie call