Retrieve token from cookie instead of query string param
See original GitHub issueVersions
- VSF 1.11
- VSF API 1.11
Bug or feature request
Feature request
Detail
Currently, VSF API requires VSF to send a token for most of authenticated requests (cart, order, etc.).
This token is stored in the browser’s local storage, which may easily be retrieved using XSS injection for instance.
A more secure approach may be using cookies to pass this token between VSF and VSF API:
- VSF API sends a
Set-Cookie
header with the token, and strong policy (httponly, secure, samesite, etc.) - VSF (transparently) sends a
Cookie
header with all VSF API requests
What do you guys think?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Deprecating usage of token as a query string parameter in ...
Until now, it's been possible to send a token as a query string parameter to issue requests to the Slack Web API. For...
Read more >Should the SessionID in the QueryString or the Cookie of a ...
To answer your specific question, I'd recommend putting session management in the cookies as opposed to the querystring.
Read more >JWT in Query String — flask-jwt-extended 3.25.1 documentation
JWT in Query String¶. You can also pass the token in as a paramater in the query string instead of as a header...
Read more >GET instead of POST for Session tokens in URL
"The URL in the request appears to contain a session token within the query string." (see error section of this article for query...
Read more >Solved: Best practices for passing an access token without...
For example, Facebook uses access tokens in query parameters ... Instead, bearer tokens SHOULD be passed in HTTP message headers or message bodies...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually the goal behind the issue hasn’t been achieved. The point of storing tokens in cookies is that JavaScript can’t access the tokens so even in case of XSS it should stay secure. During the login, the token should be saved in a cookie flagged with same-site, secure and HTTPonly. JavaScript should only be notified of how long that token is supposed to last.
Mentioned PR changed the token transportation method, but the main goal (moving from insecure storage to a secure one) has not been achieved.
Hi guys, the tokens can be now pass via
Header:
but we didn’t find much value in storing them in cookies vs. localStorage. So this option hasn’t been implemented. This PR: https://github.com/DivanteLtd/vue-storefront/pull/4626