mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 04:09:26 +00:00
Finished AuthContext
This commit is contained in:
@@ -3,7 +3,7 @@ const jwt = require("jsonwebtoken");
|
||||
module.exports = (req, res, next) => {
|
||||
let decodedToken;
|
||||
try {
|
||||
const token = req.get("Authorization").split(" ")[1];
|
||||
const [, token] = req.get("Authorization").split(" ");
|
||||
decodedToken = jwt.verify(token, "mysecret");
|
||||
} catch (err) {
|
||||
err.statusCode = 401;
|
||||
|
||||
Reference in New Issue
Block a user