GoalModelEditor/BackEnd/authen.js
// verify header sent by a user
verify header sent by a user
verify header sent by a user
function authenticate(headers) {
    var authString = headers.authorization;
    if (!authString) {
        return false;
    }
    var token = authString.split(" ")[1];
    try {
        jwt.verify(token, SECRET);
    } catch (err) {
        return false;
    }
    return true;
}
function authenticate ( headers ) { var authString = headers . authorization ; if ( ! authString ) { return false ; } var token = authString . split ( " " ) [ 1 ] ; try { jwt . verify ( token , SECRET ) ; } catch ( err ) { return false ; } return true ; }
verify header sent by a user
verify header sent by a user
// check that header contains authorization metadata // if so, extract token from authorization metadata // verification error - return false