Wednesday 25 July 2018

Server cannot parse the same cookies it issues.

Hello, I am running an express app that uses the out the box stack (cookie-parser, connect-session, etc). I am also using a i18n module that sets a cookie depending on the user's language. I am having a cookie issue where I am not sure whether I am sending the correct cookies, or if the server is having problems parsing them. Whenever I authenticate a user, it sends a cookie that looks like this"language=en-US; Path=/, keystone.uid=s%3A5b4f9dc45e23fe02b4b24862%3ACzrzXyYInv7VKl5PaevC9Ynd1qJD72Ip%2BmCd7NynoxU.rGWyRaQecitVOH4vQpZTD1ThpvQ44BI%2BmzOF51kjSms; Max-Age=864; Path=/; Expires=Wed, 25 Jul 2018 19:07:02 GMT; HttpOnly, this.sid=s%3AappByhBNAo31t5RlBF9cd80lZcsQEjE3.o4Wq9o7bhpptCrcJt6XIh1jjKQgWPgibnoI8TDalkDk; Path=/; Expires=Thu, 25 Jul 2019 18:52:38 GMT; HttpOnly"Now inside my app (its a react native app), I store that string verbatim and whenever I try sending it again in the next request, my server cannot parse it, and only parses the language cookie. I've taken that same cookie and tried sending it through fiddler, and postman and it has the same problem. The only way I am able to successfully recall my session is if I only send"this.sid=s%3AappByhBNAo31t5RlBF9cd80lZcsQEjE3.o4Wq9o7bhpptCrcJt6XIh1jjKQgWPgibnoI8TDalkDk;"in the cookie.So upon further testing I decided to download the Cookie parser module to test it individually and it indeed parses the entire cookie wrong. Anyone know whether that cookie string is really invalid to send back to the server? If it is, what can I modify to make it valid? I may have to end up writing a regex to extract the this.sid token and I am not really good with regular expressions so help with that will also be very much appreciated. Thanks

Submitted July 25, 2018 at 10:15PM by apphut

No comments:

Post a Comment