bradtraversy / proshop_mern

Shopping cart built with MERN & Redux
1.99k stars 1.18k forks source link

Expired JWT bug #13

Closed badgersmans closed 3 years ago

badgersmans commented 3 years ago

I've noticed that when the JWT expires, the frontend still stores the token in the localStorage, which doesn't make sense, as the user is still able to stay logged in, and the navbar will still show the username, but actually it should log out...

It'd be great if when the JWT expires on the backend, that the frontend would log out.

You could see this issue in action when you go to user profiles page, and wait for the JWT to time out, it will show this error message:

image

Just a suggestion...

bradtraversy commented 3 years ago

Thanks, I will definitley look into this asap. Once I add a fix, I will post a note in the course as well

badgersmans commented 3 years ago

Thank you Brad, appreciate it!

badgersmans commented 3 years ago

@bradtraversy this is also related...on orders page if JWT expires, we should log out

image

but at least the error is correctly showing here

basir commented 3 years ago

It's been fixed. check this PR: https://github.com/bradtraversy/proshop_mern/pull/14/files