Created
April 17, 2020 07:02
-
-
Save ANUPAMCHAUDHARY1117/c37a0f088e7d3ee6edf0ba9b3678b178 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cookieParser = require('cookie-parser'); | |
const jwt = require('jwt'); | |
app.get('/checkLogin', (req, res) => { | |
const token = cookieParser.signedCookie(req.signedCookies['x-access-token'], process.env.COOKIE_SECRET_KEY); | |
jwt.verify(token, process.env.SECRET_KEY, function (err, decoded) { | |
if (err) { | |
throw new Error(err); | |
} | |
return res.status(200).json({ message: 'JWT VERFIED' }); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment