Y
Y
Yaroslav Studenikin2022-04-14 19:46:41
JavaScript
Yaroslav Studenikin, 2022-04-14 19:46:41

How to authenticate user before rendering application in react?

I study jwt authorization. The task is to write the user authorization logic on the react, redux, redux-saga stack.
I authorize the user successfully using the login form. I save jwt token in local storage and user data in redux store. However, I ran into a problem. When there is a token in the storage, but not in the editor (for example, the user closed the site and logged in again). How to correctly implement the connection between the request to the server behind the user and the rendering of the application, so that if there is a token in the storage, the application will start only after the request behind the user? Share recommendations, best practices, so to speak)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question