Resources
Split Resources
Find resources for feature management, continuous delivery, feature experimentation, and more.
const jwt = require("jsonwebtoken"); const config = process.env; const verifyToken = (req, res, next) => { const token = req.body.token || req.query.token || req.headers["x-access-token"]; if (!token) { return res.status(403).send("A token is required for authentication"); } try { req.user = jwt.verify(token, config.TOKEN_KEY); } catch (err) { return res.status(401).send("Invalid Token"); } return next(); }; module.exports = verifyToken;
Resources
Load More