2 Replies Latest reply on May 1, 2017 12:34 PM by Cris Angelini

    Authentication Failure

    Cris Angelini

      Trying to connect via SoapUI. I can connect via REST but cannot connect via SOAP.

       

       

      Here is the call that I'm making...I'm just trying to make the base getLead connection but am failing on auth.  What is it that I'm doing wrong?

       

       

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mkt="http://www.marketo.com/mktows/">

         <soapenv:Header>

            <mkt:AuthenticationHeader>

       

                <!-- my mktowsUserIdfield begins with "MKTOWS_" and is the 'User ID' FIELD FROM ADMIN UI -->

               <mktowsUserId>XXXXXXXXXXXXXX</mktowsUserId>

       

                <!--

                     My requestSignature below is calculated below.  Perhaps this is what I'm messing up on.  I'm calculating it in java as below:

       

       

                          DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");

                          String text = df.format(new Date());

                          String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22);

                          String encryptString = requestTimestamp + "MKTOWS_XXX-XXX-XXX_X" ;

                          SecretKeySpec secretKey = new SecretKeySpec("[Encryption Key from admin UI]".getBytes(), "HmacSHA1");

                          Mac mac = Mac.getInstance("HmacSHA1");

                          mac.init(secretKey);

                          byte[] rawHmac = mac.doFinal(encryptString.getBytes());

                          char[] hexChars = Hex.encodeHex(rawHmac);

                          String requestSignature = new String(hexChars);

                -->

               <requestSignature>91d8dfd424143deb8fa58d65b09d0787b7c099f2</requestSignature>

       

       

               <requestTimestamp>2017-04-27T14:41:00-08:00</requestTimestamp>

               <!--Optional:-->

               <partnerId></partnerId>

               <!--Optional:-->

               <audit></audit>

               <!--Optional:-->

               <mode></mode>

            </mkt:AuthenticationHeader>

         </soapenv:Header>

         <soapenv:Body>

            <mkt:paramsGetLead>

               <leadKey>

                  <keyType>EMAIL</keyType>

                  <keyValue>freddiemac@yahoo.com</keyValue>

               </leadKey>

            </mkt:paramsGetLead>

         </soapenv:Body>

      </soapenv:Envelope>

        • Re: Authentication Failure
          David Everly

          Hello Chris,

           

          Your code to generate the signature looks correct, so it is hard to say what is happening.  I recommend posting the exact error that you are getting back. 

           

          Another approach is to generate the timestamp and hmac using sites like these:

          1. Timestamp Generator / Converter - Timestampgenerator.com

          2. Free Online HMAC Generator / Checker Tool (MD5, SHA-256, SHA-512) - FreeFormatter.com

           

          -Dave

            • Re: Authentication Failure
              Cris Angelini

              Dave, thanks for taking the time to post.  I don't think my issue is creating timestamps although I'll play with  your suggestion.  I will try the HMAC generator although I'm using the UI tool in this example and the java code you have posted on your site in the app.  The abvove was sent via SoapUI to take the app out of the equation.  Below is the result...its clearly an auth issue.  I think that the signature creation has to be the issue but for SoapUI I'm pressing the create button in the admin UI app from our account and using it here so I don't know how it could be wrong.  It has to be simple but I'm missing something...

               

              <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

                 <SOAP-ENV:Body>

                    <SOAP-ENV:Fault>

                       <faultcode>SOAP-ENV:Client</faultcode>

                       <faultstring>20014 - Authentication failed</faultstring>

                       <detail>

                          <ns1:serviceException xmlns:ns1="http://www.marketo.com/mktows/">

                             <name>mktServiceException</name>

                             <message>Authentication failed (20014)</message>

                             <code>20014</code>

                          </ns1:serviceException>

                       </detail>

                    </SOAP-ENV:Fault>

                 </SOAP-ENV:Body>

              </SOAP-ENV:Envelope>