Before going into any kind of explanation, we need to understand the difference between server side storage and client side storage when it comes t...
For further actions, you may consider blocking this person and/or reporting abuse
It seems like you have deleted the previous post and then re-created it.
Tnx for the post :)
Yes, true. To answer your question, I believe your usage of localStorage is safe, for development purposes. Unrelated to localStorge, what I would pay attention to would be not to expose your API key if the API you're using has provided you with a private key (that if tou chose to upload your project using Gihub Pages, Netlify etc).
I agree. For that reason, I use .env to protect api key
Even if you store your keys in an .env file, they will be exposed once the React project is built. For more details you can read this article
Indeed. A file with credentials should not be read by the client / frontend by JS because it means a user can access the value too.
An appropriate use for .env file credentials is if your frontend did not care about this details at all. But you have a server side REST API or Lambda which internally loads the .env file and obscures the values and then your frontend requests that service.
Also remember that a .env on GitHub can be read by other users. So typically you would use secret environment variables set in your CI so that only you and admin users can see the values and they get used in the app at build time, and when the app starts.
Do you have some resources on how to achieve this exactly? I've been dealing with this issue myself but I nevet got into details on how to obscure my API keys. Thank you!
Nie!!!
Sorry nice!!!
Not if the tabs share the same origin. It's only true if you use
sessionStorageTrue, I forgot to mention that. Thx!
Thx for pointing out the typos (bad copy paste :D). I mentioned you can access the storage both ways (with or without
window), but yes, I might as well remove thewindowkeyword in the examples.Thanks for sharing!
Very useful... Thank you
Thanks for this wonderful post :)
Thx for reading, I hope it was useful.
Nice post. Thanks for sharing.