Token exchange in localstorage gets data from other users in react js

Viewed 54

I am consuming an API in react js. I get the user's information (username, email, permissions, etc.) from his token, which is stored in localstorage. However, when replacing it with another valid token from another user, I get their data. I think it is a serious security problem. Is there a way to solve it?

For now it occurs to me to compare the value of localstorage with a state with the token. I consider that it is not the best because it will have to be necessary in each request to the backend. Or request your password to make changes. Also refresh the token.

This problem is exposed when wanting, for example, to edit the user profile.

0 Answers
Related