marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.01k stars 1.33k forks source link

Expiry not set in cookieStorage.js #325

Open virajsoni06 opened 2 years ago

virajsoni06 commented 2 years ago

There seems to be an issue with cookieStorage.js which doesn't seem to accept the expiry set for cookies. The expiry is hardcoded -> https://github.com/marcuswestin/store.js/blob/b8e22fea8738fc19da4d9e7dbf1cda6e5185c481/storages/cookieStorage.js#L43

Shouldn't the user be allowed to set it or fallback to default?

videni commented 2 years ago

this library save expires with another cookie, I don't know why this way instead of cookie expires attribute, also another drawback, if you save a string value, it will be serialized by JSON.stringify() , which means double quotes will be part of you value. you need to strip it out if cookie being passed to your server. for example, a token,

token = "abcdef", but you got token = '\"abcdef\"'