S
S
Sergey Suntsev2016-12-16 14:06:25
JavaScript
Sergey Suntsev, 2016-12-16 14:06:25

What is the best way to implement temporary (1 hour) token persistence in react.js?

I'm trying to build an authorization system on the site (node.js + react.js)
A person after authorization, if the login and password match, receives a token that should be stored for an hour in all tabs.
There is an idea to save in localstorage, read the current date of saving and if the date is over an hour, then clear the token.
Further, a similar idea with Cookies, only without fraud with time.
But maybe there is another way, using React, to save the data?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-12-16
@GreyCrew

Don't reinvent the wheel, see JWT.
In any case, the lifetime of the token must be checked by the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question