code: function(callback) {
              var that = this;
              var url = this.paths.login;
              var params = {
                  username: this.username,
                  password: this.password,
                  cookie  : '1'
              };
  
              callback = callback || function() {};
              var wrappedCallback = function(err, response) {
                  // Let's make sure that not only did the request succeed, but
                  // we actually got a non-empty session key back.
                  var hasSessionKey = !!(!err && response.data && response.data.sessionKey);
  
                  if (err || !hasSessionKey) {
                      callback(err || "No session key available", false);
                  }
                  else {
                      that.sessionKey = response.data.sessionKey;
                      callback(null, true);
                  }
              };
  
              return this.http.post(
                  this.urlify(url),
                  this._headers(),
                  params,
                  this.timeout,
                  wrappedCallback
              );
          }
docs: Authenticates and logs in to a Splunk instance, then stores the
  resulting session key.
  
  @param {Function} callback The function to call when login has finished: `(err, wasSuccessful)`.
  
  @method splunkjs.Context
  @private