Search code examples
node.jslocal-storage

LocalStorage as a request


How can I send the localstorage headers as a request to a node.js application? I need to authenticate users before letting them use my application made in nodejs, but how can I access the clients' localstorage ? Can I get it as a request to the node server?

---edit--- I recently read about CORS, can that help in this situation?


Solution

  • You can't access localStorage from the server. You can have the browser collect all the key/value pairs in localStorage and post them to the server via AJAX, but that's about it. localStorage is completely under client control and does not get shipped along as request headers (as cookies are).