90. Save Token in LocalStorage & autologout user when token is expired in React Redux App - ReactJS

  Рет қаралды 33,130

Leela Web Dev

Leela Web Dev

Күн бұрын

Пікірлер: 11
@prabhuan5981
@prabhuan5981 3 жыл бұрын
You have set 1 Hr as session timeout but with in this duration if you try to close the browser this token and localstorage never clear and still the user is logged in only. this is may be the wrong and any others can access using your login. Better for avoid this use react-redux.
@LeelaWebDev
@LeelaWebDev 3 жыл бұрын
I am saving the date in localstorage when the session is stored and checking the current date when the browser opened with the localstorage saved date
@elonpireva193
@elonpireva193 2 жыл бұрын
what if i just add in localStorage: key: userDetails and fake token will I have access to app ?
@LeelaWebDev
@LeelaWebDev 2 жыл бұрын
No
@ashrafulmalik1474
@ashrafulmalik1474 3 жыл бұрын
which token we store in browser refresh token or access token
@Jel.Awesh.M
@Jel.Awesh.M 3 жыл бұрын
Is it okay to save token in LocalStorage if it can be read by client?
@LeelaWebDev
@LeelaWebDev 3 жыл бұрын
Normally we save only the token in local storage instead of saving all the details. Every time we make a request will get a new token which in turn replaces the token in local storage. So the token will be refreshed all the time expiring the old token. In some projects, token will be saved in encrypted format
@Jel.Awesh.M
@Jel.Awesh.M 3 жыл бұрын
@@LeelaWebDev Thanks for you response.
@lineupp
@lineupp 3 жыл бұрын
@@Jel.Awesh.M It something called refresh token and token is not secure in localstorage or session storage because it can be easily be stoled by hackers using xss attack or csrf attack! I hope you got it! Awesome tutorial leela but i think you missed this little points!
@nishukumar7621
@nishukumar7621 2 жыл бұрын
Logout automatically deletes cookies
@nishukumar7621
@nishukumar7621 2 жыл бұрын
Cookie are better than localstorage with https true flag
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Local Storage & Session Storage [ with Code Examples ]
14:52
Akshay Saini
Рет қаралды 239 М.
I Tried 5 Redux Alternatives and Here is the Best one
16:48
CoderOne
Рет қаралды 24 М.
localStorage and Bearer Auth Tokens - React Tutorial 44
7:39
Caleb Curry
Рет қаралды 17 М.
🔥 What is Refresh Token in Hindi
11:33
Learn Code With Durgesh
Рет қаралды 20 М.
Difference between cookies, session and tokens
11:53
Valentin Despa
Рет қаралды 682 М.
Why I avoid useEffect For API Calls and use React Query instead
17:45