code: function connectToNylas(data) {
    return nylasCode(data)
      .then(code => {
        const params = {
          client_id: config.nylasClientId,
          client_secret: config.nylasClientSecret,
          code: code,
        };
        return nylasToken(params)
          .then(token => {
            return Promise.resolve(token);
          })
          .catch(err => {
            return Promise.reject(
              new Error(`Could not connect to Nylas. Error: ${err.message}`)
            );
          });
      })
      .catch(err => {
        return Promise.reject(
          new Error(`Could not connect to Nylas. Error: ${err.message}`)
        );
      });
  }
docs: First POST to /connect/authorize to get an authorization code from Nylas Then post to /connect/token to get an access_token that can be used to access account data