I have a webpage. I log in with my username and password. Session stored in Chrome.
In this format
Name = session
Content = .eJwlj0tuwzAMBe_CtRcSKZpiLmNI_KBBggawk1XRu1dA1w8zmPcDR55xfcHtfX5ig-PucAOOOkLYK3uhVnzOoqaqTDmyYqAhIjOatNplBpQhEFQ-Zo3nTR7pVaZjNnlbobM-E-PJXW1KMEW0EZpEIiFRM2sOvM4
I can't get the stored session. I tried lots of ways on the internet but couldn't get it.
I used document. session returns undefined. Used browser cookie library but still nothing. Used other npm packages.
All cookies examples are made for Google but can't get them from my page.
A session id like this is usually stored as a cookie so it can be passed back to the server easily with each request. So the question becomes how can I get a cookie by name?
You could probably use a one-liner a little like this- test it in the Javascript console to see whether it needs any tweaking for your situation:
document.cookie.split(';').find( (x) => x.trim().startsWith('session=')).trim().substring('session='.length);