When I run the node.JS code below I get a header value of

amx PUBLIC KEY:leFWRGAm2eH6rm9t8hoHifpMpWPV5xMZcXtuhrQbUP0=:1516453770998

Try the same values for keys and nonce in your code and compare

var nonce = 1516453770998; var API_KEY = 'PUBLIC KEY' var API_SECRET = 'PRIVATE KEY'; var md5 = crypto.createHash('md5').update( JSON.stringify( {'Currency' +:"PAC"} ) ).digest(); var requestContentBase64String = md5.toString('base64'); var signature = API_KEY + "POST" + encodeURIComponent( 'https://www.cr +yptopia.co.nz/api/GetBalance' ).toLowerCase() + nonce + requestConten +tBase64String; var hmacsignature = crypto.createHmac('sha256', new Buffer( API_SECRET +, "base64" ) ).update( signature ).digest().toString('base64'); var header_value = "amx " + API_KEY + ":" + hmacsignature + ":" + nonc +e;
poj

In reply to Re^3: POST API in Perl using LWP::UserAgent with authentication providing errors by poj
in thread POST API in Perl using LWP::UserAgent with authentication providing errors by ssara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.