I've built my MEAN web application. To authorize users I'm using JWT tokens. But there is one problem. Sometimes while reloading page I get 401 Unauthorized while I'm still authorized. I checked twice my token in locale storage and it was right there. Then I tried to reload other my pages and it's so weird cause some of the are reloading nicely and some are returning 401. I have this error while hosting my app on Heroku . I'm using angular 5 for frontend and Node js for back. Does anyone have such a problem. If you need code it's on my github https://github.com/tia337/MEAN-Stack .
Asked
Active
Viewed 175 times
-4
-
Why everyone downvotes? Are you all guys who write perfect code or who know everything on the Earth? Try to be useful to someone except yourself. You dont even try to help. think about it – tia0717 Dec 22 '17 at 19:10
-
or tell me what is wrong with my question. No code? its all on github – tia0717 Dec 22 '17 at 19:11
-
1Not your down-voter, and I am not an expert in the languages and fields you're asking about, but your question could be improved, to be sure. You should not have links to code or gitHub since all pertinent code *should* be posted with your question. Please go through the how-to-ask sections of the [help] to see how to further improve this and your future questions. – Hovercraft Full Of Eels Dec 22 '17 at 21:10
1 Answers
0
I think it have some problem in package. tokenNotExpired function have some issue. You can also check by your own whether token expired or not. Just decode your token from JWT library and compare expire time with current time. Hope it will help.

Sandip Jaiswal
- 3,428
- 2
- 13
- 15