backend/helpers/SessionManager.js
/***
     * Validates if the request is authentic
     *
     * @param decoded
     * @param request
     * @param callback
     */
Validates if the request is authentic
@param decoded
@param request
@param callback
Validates if the request is authentic @param decoded @param request @param callback
validate(decoded, request, callback) {
        if (this.sessions[decoded.id]) {
            callback(null, true);
        } else {
            User.findById(decoded.id).then(
                (user) => {
                    if (user) {
                        callback(null, true);
                    } else {
                        callback(null, false);
                    }
                }
            );
        }
    }
validate ( decoded , request , callback ) { if ( this . sessions [ decoded . id ] ) { callback ( null , true ) ; } else { User . findById ( decoded . id ) . then ( ( user ) => { if ( user ) { callback ( null , true ) ; } else { callback ( null , false ) ; } } ) ; } }
Validates if the request is authentic
 @param decoded
 @param request
 @param callback
Validates if the request is authentic @param decoded @param request @param callback
// this.newSession(decoded.id, request.auth.token)