Proposal of implementation for localStorage integration #1083
Replies: 3 comments 19 replies
-
A while back added the ability for messages being sent between the client/server to have a "type". This is, at present, basically unused, but I think it's a perfect use case for it. One can image The particular use case mentioned here is related to a broader discussion about how users should handle authentication in a ReactPy app (#828). While, from my understanding, you should always protect yourself against XSS, regardless of how client-side tokens are stored, doing so in local storage can make it easier to exploit. As such, whatever auth solution ReactPy provides will likely rely on HTTP-ONLY cookies (see solution 4 in above issue). |
Beta Was this translation helpful? Give feedback.
-
Although having See my other comment. |
Beta Was this translation helpful? Give feedback.
-
I was looking into issue #1075 and localStorage access is part of it. @Archmonger did you see how i did it? (here) Could easily apply the same logic for sessionStorage but would be good to have some feedback first. Then i was thinking about proceeding with the other items listed in #1075 |
Beta Was this translation helpful? Give feedback.
-
So, i was trying to include some login and user management features in a reactpy app and stumble uppon the fact that we dont have any way to access localStorage or any other client side stored data yet.
Thinking about that, i started implementing a way to integrate localStorage from the browser with the backend.
After some experimentation i was able to achieve this with the following logic:
The current state of this implementation is in this branch in my fork.
In
src/py/reactpy/reactpy/samples/use_local_storage.py
is a sample on how to use this method to access and alter localStorage.How i wasnt yet able to make the login page using this new feature, i wont open a pull request for now.
But would like to bring to discussion and see what you guys think about this idea.
Beta Was this translation helpful? Give feedback.
All reactions