Relative Content

Tag Archive for reactjsnode.jsexpresscookiesjwt

JWT (JSON web Token) malformed on refreshing the login page in Chat-App

When I am logged in and refreshing the page then there is no problem. But when I logout and I am on login page and then if I refresh the page then I am directed to the home page where I should be only directed after logging in. And since it is the chat app, so in the home page there are conversations which I can’t see when I refresh the page on login page. Only the layout of the home page is shown with toast message like “Request failed 500”. And “JWT malformed” is printed in the terminal. And point towards the const decoded = await promisify(jwt.verify)(token, process.env.JWT_SECRET) protectRoutes.js file