Usually each web API request sends with a cookie, and the response has a new cookie that is used by next request.
However if we use document.cookie
to get the cookie it may not be accurate if there’re multiple requests and responses.
Possible solution:
- Put all the response in a time order to get the latest cookie
- Send a new request to get a new cookie