I
I
Ivan Volkov2017-07-16 23:16:39
Express.js
Ivan Volkov, 2017-07-16 23:16:39

How to store persistent data on the client?

Goodnight. There is a small SPA in which the client part is made on react. The question arose, how to store some permanent data (for example, the username, the company in which he works) on the client? Let me explain ...
The client sent a login / password, received a web token and some permanent information about himself (login, first name, last name, company, current balance, whatever). Then he performed some actions on the site (sent data to the server, received them from it). How to store this permanent information in the browser? local storage? it is possible to replace... each time to receive them from the server at any action? seems kinda dumb to me...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Ernest Fayzullin, 2017-07-16
@ernesto77

everything can be changed on the client, not only local storage. If you need to identify a person with 100% probability, then you need to refer to the database. As far as I know it's not stupid

A
Anton, 2017-07-17
@SPAHI4

Yes, they can be changed. But if the client "believe" this new data, then there is nothing to worry about. And on the server their check should be in any case. You can use jsonwebtoken.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question