mirror of
https://github.com/EQEmu/Server.git
synced 2026-12-03 18:32:18 +00:00
Changes to building
This commit is contained in:
1 parent
83cae7aaf3
commit
72a922f2ba
47 files changed
+596
-1812
No files matched your search
@@ -1,27 +0,0 @@
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
||||
var Auth = function (req, res, next) {
|
||||
var token = '';
|
||||
try {
|
||||
token = req.headers.authorization.substring(7);
|
||||
} catch(ex) {
|
||||
console.log(ex);
|
||||
res.sendStatus(401);
|
||||
return;
|
||||
}
|
||||
|
||||
jwt.verify(token, req.key, function(err, decoded) {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
res.sendStatus(401);
|
||||
return;
|
||||
}
|
||||
|
||||
req.token = decoded;
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
'auth': Auth
|
||||
}
|
||||
Reference in new issue
Block a user