I'm developing an website and I need help to understand how to manage session ids. My session ids are generated from my backend (firebase). These session ids are put inside the header of every http request that's coming from the frontend.
Now my question: where do I save them?
I cannot use cookies because I want that even the users that do not want cookies can use my website. Any help would be appreciated. Thanks.
First of all, you can build a context which can save a session id and return at any time.
And after that, you can save a session id to local storage.
https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem
localStorage.setItem('sessionId', sessionId);
And then you can use the session by using localStorage.getItem
like below.
const sessionId = window.localStorage.getItem('sessionId');
https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem