nodejs HTTP Digest Authentication not working

I've been digging deep into stack overflow but haven't been able to solve my problem. I'm trying to access an API that uses digest but have had no success, and my co-workers haven't been able to pin down the problem either. I've hit a wall and have come to Stack Overflow to ask my question.

Here is my authentication code:

var https = require("https"),
    crypto = require('crypto'),
    _ = require('underscore');

var options = {
    host: 'api.example.com',
    port: 80,
    path: '/path/to/uri/',
    method: 'GET',
    accept: 'application/json',
    acceptEncoding: 'gzip, deflate',
    connection: 'keep-alive',
    rejectUnauthorized: false,
    requestCert: true,
    agent: false
};

var username = 'username',
    password = 'httppassword';

var req = https.get(options, function(res) {

    res.setEncoding('utf-8');

    console.log(res.url);
    console.log('STATUS: ' + res.statusCode);
    console.log('HEADERS: ' + JSON.stringify(res.headers));

    var data = "";

    res.on('data', function (chunk) {
        data = data + chunk;
    });

    res.on('end', function(){

        console.log(data);
        var challengeParams = parseDigest(res.headers['www-authenticate']);
        console.log(challengeParams);
        var ha1 = crypto.createHash('md5').update(username + ':' + challengeParams.realm + ':' + password).digest('hex');
        var ha2 = crypto.createHash('md5').update('GET:' + options.path).digest('hex');
        var response = crypto.createHash('md5').update(ha1 + ':' + challengeParams.nonce + ':1::auth:' + ha2).digest('hex');
        var authRequestParams = {
            username : username,
            realm : challengeParams.realm,
            nonce : challengeParams.nonce,
            uri : options.path, 
            qop : challengeParams.qop,
            response : response,
            nc : 1,
            cnonce : ''
        };
        options.headers = { 'Authorization' : renderDigest(authRequestParams) };
        console.log(options);
        https.get(options, function(res) {

            console.log("STATUS: " + res.statusCode);
            console.log("HEADERS: "  + JSON.stringify(res.headers));

            res.setEncoding('utf-8');
            var content = '';
            res.on('data', function(chunk) {
                content += chunk;
            }).on('end', function() {
                console.log(content);
            });
        })
    });

});

req.on('error' ,function(err){
    console.log("request");
    console.log(err);
});

req.write('data\n');
req.write('data\n');
req.end();

And here is the challenge header sent back by the API

{ realm: 'API realm',
  domain: 'https:/api.example.com/',
  qop: 'auth',
  nonce: 'UZ43b0FWC9591pMjy1i6H2okVwgMbDVO6fcgcQ' }

EDIT:

I thought it would be helpful for those looking to answer this question for me to provide what I'm actually sending back to the API, so here it is.

{ host: 'api.example.com',
  port: 80,
  path: '/path/to/uri/',
  method: 'GET',
  accept: 'application/json',
  acceptEncoding: 'gzip, deflate',
  connection: 'keep-alive',
  rejectUnauthorized: false,
  requestCert: true,
  agent: false,
  headers: { Authorization: 'Digest username="uname", realm="API realm", nonce="UZ43b0FWC9591pMjy1i6H2okVwgMbDVO6fcgcQ", uri="/path/to/uri", qop="auth", response="09c536e22bca031cdbcb289e4065064a", nc="1", cnonce=""' } }