routes/AToken.js
/** Wraps jwt.decode into a promise */
Wraps jwt.decode into a promise
Wraps jwt . decode into a promise
function decode(token, secret) {
  return new Promise(function(resolve, reject) {
    if (_.isUndefined(token)) {
      reject(new rekt.BadRequest('Every request must include a token.'));
    } else {
      try {
        var decoded = jwt.decode(token, secret);
        resolve(decoded);
      } catch (err) {
        var error = new rekt.BadRequest('Badly formed token.');
        reject(error);
      }
    }
  });
}
function decode ( token , secret ) { return new Promise ( function ( resolve , reject ) { if ( _ . isUndefined ( token ) ) { reject ( new rekt . BadRequest ( 'Every request must include a token.' ) ) ; } else { try { var decoded = jwt . decode ( token , secret ) ; resolve ( decoded ) ; } catch ( err ) { var error = new rekt . BadRequest ( 'Badly formed token.' ) ; reject ( error ) ; } } } ) ; }
Wraps jwt.decode into a promise
Wraps jwt . decode into a promise