Monday 25 February 2019

Using local storage to save JWT with React Redux?

Hello guys, actually i ended up a very basic authentication system using JWT, i'm saving it on my localStorage ( I'm using React & Redux ).Once a sign in the api returns me an object that contains User object and JWT i save these informations on my local storage even the user object, so every time the user open the website i check his JWT if it's available on the local storage or not, if yes i make him as logged in ( authenticated ) this works even offline, but i don't really like this one!​I'm really confused about what i should do , i have to use the JWT because i'm working with the Strapi CMS!I really want to make this works like many websites, i mean when you close the web browser the user disconnect, but i'm not sure if this is good or not, even Facebook website is not working like that, because if you close your browser you still authenticated!Thank you guys! any suggestion will be appreciated.

Submitted February 25, 2019 at 09:29AM by ayech0x2

No comments:

Post a Comment