<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: validate request implement in java in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269573#M24337</link>
    <description>&lt;P&gt;I tried to send request body, but is too long and superate&amp;nbsp;60,000 characters in length. I can't add a file in this forum. If you want I can send an email.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2019 15:19:51 GMT</pubDate>
    <dc:creator>lord_dark_basic</dc:creator>
    <dc:date>2019-05-10T15:19:51Z</dc:date>
    <item>
      <title>Validate request implementation in Java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269127#M24291</link>
      <description>&lt;P&gt;Hi, I trying to validate request from Hubspot. I had an app in Java with this code to validate auth header token Token.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;@Service
public class HubspotAuth {

    @Autowired
    Hubspot hubspotAuthentication;

    @Value( "${chargebee.redirectUri:https://3b69d752.ngrok.io/api/v1/subscription}" )
    private String redirectUri;

    private Gson gson = new Gson();

    public Boolean checkToken(Object request, String token){
        String jsonRequestString = gson.toJson(request);
        String hash = hubspotAuthentication.getClientSecret() + jsonRequestString;
        String sha256hex = Hashing.sha256()
                .hashString(hash, StandardCharsets.UTF_8)
                .toString();
        return sha256hex.equals(token);
    }
}&lt;/PRE&gt;
&lt;P&gt;I tried to with this input :&lt;/P&gt;
&lt;PRE&gt;String hash = hubspotAuthentication.getClientSecret() + "POST" + redirectUri + jsonRequestString;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had an app in HubSpot and a webhook.&amp;nbsp; App id&amp;nbsp;&amp;nbsp;190755.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2019-05-08 15-58-59.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/17042iB9FADCD147939117/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2019-05-08 15-58-59.png" alt="Screenshot from 2019-05-08 15-58-59.png" /&gt;&lt;/span&gt;If you need, I can send a request body, but it's a boil of text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 20:14:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269127#M24291</guid>
      <dc:creator>lord_dark_basic</dc:creator>
      <dc:date>2020-04-06T20:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: validate request implement in java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269431#M24326</link>
      <description>&lt;P&gt;Welcome,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/93960"&gt;@lord_dark_basic&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you direct message me the following so that I may test on my end?&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The request body you sent.&lt;/LI&gt;
&lt;LI&gt;The&amp;nbsp;&lt;CODE&gt;X-HubSpot-Signature&lt;/CODE&gt; value you received.&lt;/LI&gt;
&lt;LI&gt;The string you generated using &lt;CODE&gt;hash = hubspotAuthentication.getClientSecret() + "POST" + redirectUri + jsonRequestString;&lt;/CODE&gt;. (Feel free to redact all but the first &lt;EM&gt;five&lt;/EM&gt; characters in your client secret.)&lt;/LI&gt;
&lt;LI&gt;The hash value you generated from the string above.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 09 May 2019 20:13:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269431#M24326</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2019-05-09T20:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: validate request implement in java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269572#M24336</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The request body you sent? I receive a body request.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 15:13:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269572#M24336</guid>
      <dc:creator>lord_dark_basic</dc:creator>
      <dc:date>2019-05-10T15:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: validate request implement in java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269573#M24337</link>
      <description>&lt;P&gt;I tried to send request body, but is too long and superate&amp;nbsp;60,000 characters in length. I can't add a file in this forum. If you want I can send an email.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 15:19:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269573#M24337</guid>
      <dc:creator>lord_dark_basic</dc:creator>
      <dc:date>2019-05-10T15:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: validate request implement in java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269601#M24341</link>
      <description>&lt;P&gt;SOLVED !!!&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;private &lt;/SPAN&gt;ObjectWriter &lt;SPAN&gt;ow &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;ObjectMapper().writer()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;public &lt;/SPAN&gt;Boolean &lt;SPAN&gt;checkToken&lt;/SPAN&gt;(Object request&lt;SPAN&gt;, &lt;/SPAN&gt;String token) &lt;SPAN&gt;throws &lt;/SPAN&gt;JsonProcessingException {&lt;BR /&gt;    &lt;SPAN&gt;log&lt;/SPAN&gt;.info(&lt;SPAN&gt;"With redirect uri " &lt;/SPAN&gt;+ &lt;SPAN&gt;redirectUri &lt;/SPAN&gt;+ &lt;SPAN&gt;"  and secret "  &lt;/SPAN&gt;+ &lt;SPAN&gt;hubspotAuthentication&lt;/SPAN&gt;.getClientSecret())&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;log&lt;/SPAN&gt;.info(&lt;SPAN&gt;"Expect token ---&amp;gt;  "&lt;/SPAN&gt;+ token)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    String&lt;BR /&gt;        jsonRequestString = &lt;SPAN&gt;ow&lt;/SPAN&gt;.writeValueAsString(request)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    String hash = &lt;SPAN&gt;hubspotAuthentication&lt;/SPAN&gt;.getClientSecret() + &lt;SPAN&gt;"POST" &lt;/SPAN&gt;+ &lt;SPAN&gt;redirectUri &lt;/SPAN&gt;+ jsonRequestString&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    String sha256hex = Hashing.&lt;SPAN&gt;sha256&lt;/SPAN&gt;()&lt;BR /&gt;            .hashString(hash&lt;SPAN&gt;, &lt;/SPAN&gt;StandardCharsets.&lt;SPAN&gt;UTF_8&lt;/SPAN&gt;)&lt;BR /&gt;            .toString()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;log&lt;/SPAN&gt;.info(&lt;SPAN&gt;"Generate token ---&amp;gt;  "&lt;/SPAN&gt;+ sha256hex)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    return &lt;/SPAN&gt;sha256hex.equals(token)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; Thx for all .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 15:25:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269601#M24341</guid>
      <dc:creator>lord_dark_basic</dc:creator>
      <dc:date>2019-05-15T15:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: validate request implement in java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269611#M24343</link>
      <description>&lt;P&gt;Nice work,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/93960"&gt;@lord_dark_basic&lt;/a&gt;! I'm sure others will benefit from your solution as well&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://community.hubspot.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, I misspoke earlier regarding the "body you sent." Thanks for understanding anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 18:12:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/269611#M24343</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2019-05-10T18:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: validate request implement in java</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/272602#M24741</link>
      <description>&lt;P&gt;I am having the same issue here and cannot figure out what I am doing wrong &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am using c# .net and I have tried all 3 validation methods but none of them generate a matching hash.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/17438iD654D6C0EFDB5BA5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;string hashString = HubspotRequestHelper.GetSignatureWithSecretAndBody(context, strJSON);&lt;BR /&gt;string hashString2 = HubspotRequestHelper.GetSignatureWithSecretAndMethodAndUri(context);&lt;BR /&gt;string hashString3 = HubspotRequestHelper.GetSignatureWithSecretAndMethodAndUriAndBody(context, strJSON);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My AppID is&amp;nbsp;194321 and I am attaching a file with some attempt of webhook validation.. printing the hubspot signature, and all my 3 hash attempts ... The body is too long how can I forward it to you? Please help me understand how to correct this validation issue. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----------------------------------------------&lt;/P&gt;&lt;P&gt;http_method=POST|uri=&lt;A href="https://hubspotrequests.azurewebsites.net/default.aspx|" target="_blank" rel="noopener"&gt;https://hubspotrequests.azurewebsites.net/default.aspx|&lt;/A&gt;&lt;BR /&gt;Hubspot SIGNATURE: 67c2c247f4ea809f2d3fffcdbb7e67179980f45e441eb04d55eee8490091f701&lt;BR /&gt;uri:&lt;A href="https://hubspotrequests.azurewebsites.net/default.aspx|" target="_blank" rel="noopener"&gt;https://hubspotrequests.azurewebsites.net/default.aspx|&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My 3 hash attempts&lt;BR /&gt;d6676db9e68e700e7cd64fe4732623df70527fd5ed97f706c7b197a2c56afc96|&lt;BR /&gt;b56a37ad42748356229750033de92672cc8eba8d9775b751a6c8b44bd866569b|&lt;BR /&gt;df2f525f74e2b94f45d800fad905bd1b2c30408b7370eec2fa318a4403e688b7|&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 07:47:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Validate-request-implementation-in-Java/m-p/272602#M24741</guid>
      <dc:creator>danielad</dc:creator>
      <dc:date>2019-05-30T07:47:50Z</dc:date>
    </item>
  </channel>
</rss>

