lib/vineapple.js
function (username, password, callback) {

    var request;
    var promise;

    // Preemptively validate username and password
    if (!username) {
      throw new Error('Invalid credentials. Missing username.');
    }

    if (!password) {
      throw new Error('Invalid credentials. Missing password.');
    }

    // Execute the API request for authentication
    request = this.request({
      method: 'post',
      url: 'users/authenticate',
      form: {
        deviceToken: Vineapple.DEVICE_TOKEN || createDeviceToken([
          Vineapple.DEVICE_TOKEN_SEED,
          username,
          password
        ].join(':')),
        username: username,
        password: password
      }
    });

    promise = request.then(this.authorize.bind(this));

    if (callback) {
      promise.then(callback.bind(null, null)).fail(callback);
    }

    return promise;
  }
function (username, password, callback) {

    var request;
    var promise;

    // Preemptively validate username and password
    if (!username) {
      throw new Error('Invalid credentials. Missing username.');
    }

    if (!password) {
      throw new Error('Invalid credentials. Missing password.');
    }

    // Execute the API request for authentication
    request = this.request({
      method: 'post',
      url: 'users/authenticate',
      form: {
        deviceToken: Vineapple.DEVICE_TOKEN || createDeviceToken([
          Vineapple.DEVICE_TOKEN_SEED,
          username,
          password
        ].join(':')),
        username: username,
        password: password
      }
    });

    promise = request.then(this.authorize.bind(this));

    if (callback) {
      promise.then(callback.bind(null, null)).fail(callback);
    }

    return promise;
  }
function ( username , password , callback ) { var request ; var promise ; // Preemptively validate username and password if ( ! username ) { throw new Error ( 'Invalid credentials. Missing username.' ) ; } if ( ! password ) { throw new Error ( 'Invalid credentials. Missing password.' ) ; } // Execute the API request for authentication request = this . request ( { method : 'post' , url : 'users/authenticate' , form : { deviceToken : Vineapple . DEVICE_TOKEN || createDeviceToken ( [ Vineapple . DEVICE_TOKEN_SEED , username , password ] . join ( ':' ) ) , username : username , password : password } } ) ; promise = request . then ( this . authorize . bind ( this ) ) ; if ( callback ) { promise . then ( callback . bind ( null , null ) ) . fail ( callback ) ; } return promise ; }
Authenticate the Vine API client
@param username {String}
@param password {String}
@param callback {Function} [optional]
@return {Object} request API promise
Authenticate the Vine API client