verifyJWT (token) {
    if (typeof token !== 'string') {
      return Promise.reject(new Error('Token provided to verifyJWT is missing or not a string'));
    }

    try {
      let payload = decode(token);

      if (this.payloadIsValid(payload)) {
        return Promise.resolve(payload);
      }

      return Promise.reject(new Error('Invalid token: expired'));
    } catch (error) {
      return Promise.reject(new Error('Cannot decode malformed token.'));
    }
  }
// Pass a jwt token, get back a payload if it's valid.
Pass a jwt token, get back a payload if it's valid.
Pass a jwt token get back a payload if it ' s valid .
verifyJWT (token) {
    if (typeof token !== 'string') {
      return Promise.reject(new Error('Token provided to verifyJWT is missing or not a string'));
    }
    try {
      let payload = decode(token);
      if (this.payloadIsValid(payload)) {
        return Promise.resolve(payload);
      }
      return Promise.reject(new Error('Invalid token: expired'));
    } catch (error) {
      return Promise.reject(new Error('Cannot decode malformed token.'));
    }
  }
verifyJWT ( token ) { if ( typeof token !== 'string' ) { return Promise . reject ( new Error ( 'Token provided to verifyJWT is missing or not a string' ) ) ; } try { let payload = decode ( token ) ; if ( this . payloadIsValid ( payload ) ) { return Promise . resolve ( payload ) ; } return Promise . reject ( new Error ( 'Invalid token: expired' ) ) ; } catch ( error ) { return Promise . reject ( new Error ( 'Cannot decode malformed token.' ) ) ; } }
Pass a jwt token, get back a payload if it's valid.
Pass a jwt token get back a payload if it ' s valid .