<?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: Make a GET call api with authorization in Custom Code Action in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215421#M3256</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/652686"&gt;@splancon&lt;/a&gt;&amp;nbsp;and welcome, we are so glad to have you here!&lt;BR /&gt;&lt;BR /&gt;Thanks for reaching out to the HubSpot Community!&lt;BR /&gt;&lt;BR /&gt;To start with, I'd like to share resources that might help you:&lt;BR /&gt;&lt;BR /&gt;-&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/overview" target="_blank" rel="noopener"&gt;Authentication overview&lt;/A&gt;&lt;BR /&gt;-&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/apps/legacy-apps/authentication/intro-to-auth" target="_blank" rel="noopener"&gt;HubSpot APIs | Authentication methods on HubSpot&lt;/A&gt;&lt;BR /&gt;-&amp;nbsp;&lt;A href="https://knowledge.hubspot.com/workflows/how-do-i-use-webhooks-with-hubspot-workflows" target="_blank" rel="noopener"&gt;Use webhooks with HubSpot workflows&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Now, let's consult our Top Experts: Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/9629"&gt;@HubDoPete&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/115766"&gt;@nickdeckerdevs1&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/711889"&gt;@Humashankar&lt;/a&gt;&amp;nbsp;do you have suggestions to help&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/652686"&gt;@splancon&lt;/a&gt;, please?&lt;BR /&gt;&lt;BR /&gt;Have a great day and thanks so much!&lt;BR /&gt;Bérangère&lt;/P&gt;</description>
    <pubDate>Thu, 23 Oct 2025 07:06:23 GMT</pubDate>
    <dc:creator>BérangèreL</dc:creator>
    <dc:date>2025-10-23T07:06:23Z</dc:date>
    <item>
      <title>Make a GET call api with authorization in Custom Code Action</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1214945#M3253</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I try to get data from External api in a custom action in workflow. The external API need authorization header, but it seems that header Authorization not used by axios.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;const axios = require('axios')
  
exports.main = async (event, callback) =&amp;gt; {
  const apiUrl = 'http://www.cloud.lims.fr/lims/webservices/clients/FakeId';
  const email = event.inputFields['email'];
  
  const headers = {
    'Authorization': "Basic "+Buffer.from(process.env.limseo_test_auth).toString("base64"),
    'Content-Type': 'application/json'
  };
  console.log(headers);
 
  axios.get(
    apiUrl,
    { 'headers': headers }
  )
  .then(response =&amp;gt; {
    console.log(response.data);
  }).catch(function (error) {
        if (error.response) {
          // Request made and server responded
          console.log(error.response.data);
          console.log(error.response.status);
          console.log(error.response.headers);
        } else if (error.request) {
          // The request was made but no response was received
          console.log(error.request);
        } else {
          // Something happened in setting up the request that triggered an Error
          console.log('Error', error.message);
        }
    });

  callback({
    outputFields: {
      email: email
    }
  });
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code seems good, I tried it directly in an index.js on my local machine and I get expected response and if I a try with a wrong basic authorization I get Non authorized response.&lt;/P&gt;
&lt;P&gt;In Hubspot, my call is redirect to the login page of the external app like if the authorization is missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone have any idea about this problem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for your reponses.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 09:05:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1214945#M3253</guid>
      <dc:creator>splancon</dc:creator>
      <dc:date>2025-10-22T09:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Make a GET call api with authorization in Custom Code Action</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215421#M3256</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/652686"&gt;@splancon&lt;/a&gt;&amp;nbsp;and welcome, we are so glad to have you here!&lt;BR /&gt;&lt;BR /&gt;Thanks for reaching out to the HubSpot Community!&lt;BR /&gt;&lt;BR /&gt;To start with, I'd like to share resources that might help you:&lt;BR /&gt;&lt;BR /&gt;-&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/overview" target="_blank" rel="noopener"&gt;Authentication overview&lt;/A&gt;&lt;BR /&gt;-&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/apps/legacy-apps/authentication/intro-to-auth" target="_blank" rel="noopener"&gt;HubSpot APIs | Authentication methods on HubSpot&lt;/A&gt;&lt;BR /&gt;-&amp;nbsp;&lt;A href="https://knowledge.hubspot.com/workflows/how-do-i-use-webhooks-with-hubspot-workflows" target="_blank" rel="noopener"&gt;Use webhooks with HubSpot workflows&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Now, let's consult our Top Experts: Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/9629"&gt;@HubDoPete&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/115766"&gt;@nickdeckerdevs1&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/711889"&gt;@Humashankar&lt;/a&gt;&amp;nbsp;do you have suggestions to help&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/652686"&gt;@splancon&lt;/a&gt;, please?&lt;BR /&gt;&lt;BR /&gt;Have a great day and thanks so much!&lt;BR /&gt;Bérangère&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 07:06:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215421#M3256</guid>
      <dc:creator>BérangèreL</dc:creator>
      <dc:date>2025-10-23T07:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Make a GET call api with authorization in Custom Code Action</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215448#M3257</link>
      <description>&lt;P&gt;When you console log the headers - do they match 100% between local and hubspot environments?&lt;/P&gt;
&lt;P&gt;If they do I'd look at the api you are connecting to to see if there is a domain or url white list that you need to set up.&amp;nbsp;&lt;BR /&gt;if not:&lt;/P&gt;
&lt;P&gt;id guess it might be your secret not set or activated in the custom code&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Moderator note: While this might not be the solution to the original poster's question, it might be helpful for other Community Members.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Nov 2025 11:50:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215448#M3257</guid>
      <dc:creator>nickdeckerdevs1</dc:creator>
      <dc:date>2025-11-03T11:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Make a GET call api with authorization in Custom Code Action</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215590#M3270</link>
      <description>&lt;P&gt;The authorization headers is strickly identical between local and hubspot environments. I atteched a screenshot to show them, the end of the authorization header is truncated about securtiy but each as the same value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not about a white list on domain or URL, because in Hubspot it's works perfectly if I use Pyhton to make my custom code.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 13:26:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215590#M3270</guid>
      <dc:creator>splancon</dc:creator>
      <dc:date>2025-10-23T13:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Make a GET call api with authorization in Custom Code Action</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215620#M3274</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/652686"&gt;@splancon&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;The screenshot you attached clearly shows that the Authorization header sent in both the local Node.js environment and the HubSpot Custom Code Action is identical, so the header formatting or value itself is not the source of the issue.&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;Given that:&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;UL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;The problem does not seem to be related to the header's value, domain whitelisting, or the API endpoint, since when you use Python (instead of Node.js/axios) in HubSpot custom code, the external API call succeeds and authorization works as expected.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;Just to bottomline,&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;Given your setup works fine in Python custom code, you may be encountering a HubSpot-specific restriction or bug with Node.js/axios requests involving the Authorization header. If the above suggestions do not resolve it, consider switching to Python for your workflow's custom action (if that is an option), as that approach has a proven track record in HubSpot custom workflow actions for authenticated external API calls.​&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;If you need to persist with Node.js, open a ticket with HubSpot developer support referencing your findings - identical headers, API behavior change only in Node.js, and Python bypasses the issue. Attach your logs and request details, they may need to whitelist Node.js authorization behavior or provide guidance for your Operations Hub environment.&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;To lear more on the&amp;nbsp;Custom Code Action in HubSpot,&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/How-to-Add-an-Authorization-Header-to-Custom-Workflow-Actions/m-p/1125695" target="_blank"&gt;HubSpot Community - Re: How to Add an Authorization Header to Custom Workflow Actions? - HubSpot Community&lt;/A&gt;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;STRONG&gt;Hope this helps - Happy to help further!!&lt;BR /&gt;Thank you very much and have a great one!&lt;BR /&gt;Warm regards&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 14:09:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Make-a-GET-call-api-with-authorization-in-Custom-Code-Action/m-p/1215620#M3274</guid>
      <dc:creator>Humashankar</dc:creator>
      <dc:date>2025-10-23T14:09:43Z</dc:date>
    </item>
  </channel>
</rss>

