<?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 API Key to Private App Migration: Authentication credentials not found in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/787843#M63569</link>
    <description>&lt;P&gt;Hey all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've got this serverless, just migrated to private app auth:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;exports.main = async (context, sendResponse) =&amp;gt; {
  const authToken = process.env.sparkling_zoo;
  const session_id = context.params.sid;
  const payload_archiveSession = {
    sn_archived: true,
  };
  const endpoint_archiveSession = `https://api.hubapi.com/crm/v3/objects/2-3994900/${session_id}/`;
  const headers = {
    "Content-Type": "application/json",
    Accept: "application/json",
    Authorization: `Bearer ${authToken}`
  };

  // Update playgroup
  try {
    const response_archiveSession = await patchObject(
      payload_archiveSession,
      headers,
      endpoint_archiveSession
    );

    sendResponse({
      body: {
        response: response_archiveSession.data,
      },
      statusCode: 200,
    });
  } catch (error) {
    console.log(error);
    sendResponse({
      body: {
        error: error,
      },
      statusCode: 500,
    });
  }
};
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I get the response:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  status: 'error',
  message: 'Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview',
  correlationId: '7070227d-f1a6-4dec-bf50-3ff52d7c4f29',
  category: 'INVALID_AUTHENTICATION'
}
2023-04-28T17:24:42.112Z        INFO    401
2023-04-28T17:24:42.112Z        INFO    {
  date: 'Fri, 28 Apr 2023 17:24:42 GMT',
  'content-type': 'application/json;charset=utf-8',
  'content-length': '316',
  connection: 'close',
  'cf-ray': '7bf100123d5c5943-IAD',
  'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
  vary: 'origin',
  'cf-cache-status': 'DYNAMIC',
  'access-control-allow-credentials': 'false',
  'x-hubspot-auth-failure': '401 Unauthorized',
  'x-hubspot-correlation-id': '7070227d-f1a6-4dec-bf50-3ff52d7c4f29',
  'x-trace': '2BCADEFF9EAC1EC6F060FF087DC2950FEAC4CDA6B8000000000000000000',
  'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=QtvlmIGqU1BIUSnIGzG39klIxjRCkVC%2BvAKtoVTiF32d6vOMM242CXacvlGzhRoBUGoELHX%2FMx7tSupXFMgyKd66Bp7krZbtr56F1jkKxtGtvTb%2BBa891CE1cYLL7RZc"}],"group":"cf-nel","max_age":604800}',
  nel: '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}',
  server: 'cloudflare',
  'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is happening for all function is the portal &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've triple checked that the private app has the correct scope(it now has all of them), that the private app is accessible in the function(console logged it out), and still coming up with nothing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We get no logs in the Private App HS view. The logs shown are from the terminal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I revert this back to api keys with no other changes the functino works as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt; any insights?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Apr 2023 17:40:36 GMT</pubDate>
    <dc:creator>Kevin-C</dc:creator>
    <dc:date>2023-04-28T17:40:36Z</dc:date>
    <item>
      <title>API Key to Private App Migration: Authentication credentials not found</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/787843#M63569</link>
      <description>&lt;P&gt;Hey all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've got this serverless, just migrated to private app auth:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;exports.main = async (context, sendResponse) =&amp;gt; {
  const authToken = process.env.sparkling_zoo;
  const session_id = context.params.sid;
  const payload_archiveSession = {
    sn_archived: true,
  };
  const endpoint_archiveSession = `https://api.hubapi.com/crm/v3/objects/2-3994900/${session_id}/`;
  const headers = {
    "Content-Type": "application/json",
    Accept: "application/json",
    Authorization: `Bearer ${authToken}`
  };

  // Update playgroup
  try {
    const response_archiveSession = await patchObject(
      payload_archiveSession,
      headers,
      endpoint_archiveSession
    );

    sendResponse({
      body: {
        response: response_archiveSession.data,
      },
      statusCode: 200,
    });
  } catch (error) {
    console.log(error);
    sendResponse({
      body: {
        error: error,
      },
      statusCode: 500,
    });
  }
};
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I get the response:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  status: 'error',
  message: 'Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview',
  correlationId: '7070227d-f1a6-4dec-bf50-3ff52d7c4f29',
  category: 'INVALID_AUTHENTICATION'
}
2023-04-28T17:24:42.112Z        INFO    401
2023-04-28T17:24:42.112Z        INFO    {
  date: 'Fri, 28 Apr 2023 17:24:42 GMT',
  'content-type': 'application/json;charset=utf-8',
  'content-length': '316',
  connection: 'close',
  'cf-ray': '7bf100123d5c5943-IAD',
  'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
  vary: 'origin',
  'cf-cache-status': 'DYNAMIC',
  'access-control-allow-credentials': 'false',
  'x-hubspot-auth-failure': '401 Unauthorized',
  'x-hubspot-correlation-id': '7070227d-f1a6-4dec-bf50-3ff52d7c4f29',
  'x-trace': '2BCADEFF9EAC1EC6F060FF087DC2950FEAC4CDA6B8000000000000000000',
  'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=QtvlmIGqU1BIUSnIGzG39klIxjRCkVC%2BvAKtoVTiF32d6vOMM242CXacvlGzhRoBUGoELHX%2FMx7tSupXFMgyKd66Bp7krZbtr56F1jkKxtGtvTb%2BBa891CE1cYLL7RZc"}],"group":"cf-nel","max_age":604800}',
  nel: '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}',
  server: 'cloudflare',
  'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is happening for all function is the portal &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've triple checked that the private app has the correct scope(it now has all of them), that the private app is accessible in the function(console logged it out), and still coming up with nothing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We get no logs in the Private App HS view. The logs shown are from the terminal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I revert this back to api keys with no other changes the functino works as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt; any insights?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 17:40:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/787843#M63569</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2023-04-28T17:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: API Key to Private App Migration: Authentication credentials not found</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/788281#M63582</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on the error message you provided, it seems that the authentication credentials are not being passed correctly to HubSpot's API.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 08:13:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/788281#M63582</guid>
      <dc:creator>himanshurauthan</dc:creator>
      <dc:date>2023-05-01T08:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: API Key to Private App Migration: Authentication credentials not found</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/788356#M63595</link>
      <description>&lt;P&gt;Following up on this.&lt;BR /&gt;&lt;BR /&gt;After working extensively with support and our CAM it was discovered that there is a bug on the HS side preventing the auth from being accepted by the endpoint &lt;span class="lia-unicode-emoji" title=":upside_down_face:"&gt;🙃&lt;/span&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 14:52:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/788356#M63595</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2023-05-01T14:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: API Key to Private App Migration: Authentication credentials not found</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/788405#M63598</link>
      <description>&lt;P&gt;Thanks for taking the time to flag this and follow up about it. I was OOO on Friday.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are appreciated,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":raising_hands:"&gt;🙌&lt;/span&gt; — Jaycee&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 16:25:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Key-to-Private-App-Migration-Authentication-credentials-not/m-p/788405#M63598</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-05-01T16:25:19Z</dc:date>
    </item>
  </channel>
</rss>

