'Struggling with Login API to retrieve bearer token for data API in Azure

So I'm trying to use 2 API's from our external data source, an organization that solely focuses on delivering data to customers (me).

They have 2 different API's:

  • A login API: this API is called with basic authentication (username and password) and will provide a bearer token
  • An API to extract data and manage filters (this API will require the bearer token acquired through the login API)

Important notes:

  • The login API requires a self-signed certificate, I have created a certificate on my PC using openSSL and shared the public key with the external data source.
  • I uploaded the .pfx file in Azure (however i cannot set the domain or port number, this seems to be an issue, I can do this in Postman but can't seem to find it in Azure)
  • The data source confirmed that the certificate is valid and I am able to use the certificate in Postman but only if i set the correct hostname and also the correct port number (Else i get a TLS error in Postman)
  • Everything is working as it should in Postman (I can call the Login API and i can use the bearer token to access and download the data using a json file made for postman that i received from the data source organization)

I uploaded the .pfx certificate in Azure using AppServices > TLS/SSL settings and upload the private certificate, however the hostname it says here is my own database name (I am not sure if this is correct, in Postman i set the hostname when i upload the certificate to be the hostname of our data source with the needed port number)

I tried making a web call in Azure Datafactory, here i've used the correct URL i also use in Postman to access the login API and selected basic authentication and filled in the credentials

However when i try to debug pipeline (only the login web call) it gives the following error:

Error code 2108 Troubleshooting guide Failure type User configuration issue DetailsError calling the endpoint '[LINK i put with portnumber, which is correct]'. Response status code: 'NA - Unknown'. More details: Exception message: 'NA - Unknown [ClientSideException] An error occurred while sending the request.'.

Request didn't reach the server from the client. This could happen because of an underlying issue such as network connectivity, a DNS failure, a server certificate validation or a timeout. Source Pipeline Punctuality

Am i looking in the wrong direction for this kind of data retrieval? is something going wrong with the certificate? I can't seem to find where i can set the correct hostname and port number (Like i can in Postman when uploading the certificate in .pfx format) Should I use API Management Service rather than Data Factory to make the API call to the external data source?



Solution 1:[1]

Select the authentication method as Client Certificate in web activity settings.

enter image description here

Specify base64-encoded contents of a PFX file in Pfx.

Solution 2:[2]

Since the input and output items aren't one-to-one, .map won't work.

A plain loop will, though - while iterating, just check if it's tab or tabContent, and if tabContent, push to the childContent of the last array pushed.

const arr=[{id:1,type:"tab",content:"Tab 1"},{id:20,type:"tabContent",content:"Tab 1 content..."},{id:2,type:"tabContent",content:"Tab 1 content..."},{id:3,type:"tabContent",content:"Tab 1 content..."},{id:5,type:"tabContent",content:"Tab 1 content..."},{id:22,type:"tab",content:"Tab 2"},{id:7,type:"tabContent",content:"Tab 2 content..."},{id:8,type:"tabContent",content:"Tab 2 content..."},{id:9,type:"tabContent",content:"Tab 2 content..."},{id:10,type:"tabContent",content:"Tab 2 content..."},{id:11,type:"tabContent",content:"Tab 2 content..."},{id:12,type:"tabContent",content:"Tab 2 content..."},{id:99,type:"tab",content:"Tab 3"},{id:14,type:"tabContent",content:"Tab 3 content..."},{id:15,type:"tabContent",content:"Tab 3 content..."},{id:16,type:"tabContent",content:"Tab 3 content..."},{id:17,type:"tabContent",content:"Tab 3 content..."}];

const result = [];
for (const obj of arr) {
  if (obj.type === 'tab') {
    result.push({ ...obj, childContent: [] });
  } else {
    result[result.length - 1].childContent.push(obj);
  }
}
console.log(result);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NiharikaMoola-MT
Solution 2 CertainPerformance