https://github.com/fac-14/KaMoSiMa/blob/master/src/router.js#L21
This line is throwing an error, both when I register and when I register and after I login, logout, and then try to access one of the protected routers: TypeError: Cannot read property 'logged_in' of undefined
Possible fix: if you don't use an 'if/else', you need to return your if error callback otherwise your function keeps running and the error gets thrown in line 21.
const isAuth = (userCookie, callback) => {
if (userCookie) {
console.log(`user provided cookie: ${userCookie}`);
let parsedCookie = cookie.parse(userCookie);
jwt.verify(parsedCookie['data'], process.env.JWT_SECRET, (err, decoded) => {
if (err || !decoded) {
return callback("error");
}
callback(null, decoded['logged_in']);
});
} else {
callback("error");
}
}
https://github.com/fac-14/KaMoSiMa/blob/master/src/router.js#L21
This line is throwing an error, both when I register and when I register and after I login, logout, and then try to access one of the protected routers:
TypeError: Cannot read property 'logged_in' of undefinedPossible fix: if you don't use an 'if/else', you need to
returnyour if error callback otherwise your function keeps running and the error gets thrown in line 21.