Last active
May 17, 2019 15:15
-
-
Save Danielshow/507021287039c06a9f69712fff22f0e5 to your computer and use it in GitHub Desktop.
This file contains 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
import jwt from 'jsonwebtoken' | |
const verifyToken = (req, res) => { | |
const headers = req.headers['authorization'] | |
if (!headers) { | |
// any error | |
} | |
const token = req.headers.authorization.split(' ')[1] | |
const user = jwt.verify(token, //secretkey) | |
req.user = user; | |
} | |
res.status(200).json({ | |
data: {}, | |
message: '' | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment