Added new auth function to lib/authenticate

This commit is contained in:
Daniel Vestøl committed 2018-12-09 15:59:11 +01:00
1 parent 8c0a4b1a9e
commit 274c5af9f5
1 file changed
+11
+11
View File
@@ -13,5 +13,16 @@ module.exports = function(config){
next();
});
},
check: async function(token){
return new Promise((resolve, reject) => {
jwt.verify(token, config.masterAuthSecret, function(err, decoded) {
if(err){
resolve({ok:false, msg:err})
} else {
resolve({ok:true, msg:"Successfully authenticated"});
}
});
});
}
}
};