2 Replies Latest reply on May 3, 2013 5:14 PM by 22662

    Getting 20014 - Authentication failed error

           Hi Guys,

           I just started using Marketo API. Created simple client for accessing leads. I have followed the documentation to create my request. SOAP request is as follows.

           <?xml version='1.0' encoding='UTF-8'?>
           <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                   <ns1:AuthenticationHeader xmlns:ns1="http://www.marketo.com/mktows/">
                   <ns1:paramsGetLead xmlns:ns1="http://www.marketo.com/mktows/">

           The mktowsUserId and URL Endpoint are correct, I have checked it. I am using following code to generate signature

               public static String calculateHMAC(String data, String timeStamp, String key)
               throws java.security.SignatureException
                   String result;
                   try {
                       SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), HMAC_SHA1_ALGORITHM);
                       Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
                       String signatureData = timeStamp.concat(data);
                       byte[] rawHmac = mac.doFinal(signatureData.getBytes());
                       result = DatatypeConverter.printBase64Binary(rawHmac);            
                   } catch (Exception e) {
                   throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
                   return result;


           I am not sure what is wrong, Could you guys please check my request and signature generation method are correct or not?