Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

How to create a custom connector that uses HMAC-SHA256 hashing

Here is the API I am trying to connect to in power bi:

 

https://apidocs.unleashedsoftware.com/AuthenticationHelp

 

There are 4 required headers

1) content-type (application/json)

2) Accept (application/json)

3) api-auth-id (app ID)

4) api-auth-signature (API key that is hashed with HMAC-SHA256)

 

Upon doing some research I have discovered that I need to create a custom connector using the power query sdk in visual studio.  Furthermore, I need to use the node.js function called crypto.hmac (https://nodejs.org/api/crypto.html#crypto_crypto_createhmac_algorithm_key_options) so that I can hash this signature.

 

With that being said, this is way out of my comfort zone.  Can anybody help me understand what the syntax would look like that would allow me to add this as a connector in power bi and pass in the above information.  The hardest part for me is understanding how to incorporate the crypto.hmac function in visual studio.

3 REPLIES 3
Anonymous
Not applicable

Hi,

 

Have you solved your issue? Facing something similar.

Ok I am actually very close, but having issues with the crypto.createhmac function:

 

section TripPin;

[DataSource.Kind="TripPin", Publish="TripPin.Publish"]
shared TripPin.Feed = Value.ReplaceType(TripPinImpl, type function (url as Uri.Type) as any);

TripPinImpl = (url as text) =>
let
source = Web.Contents(url, [ Headers = DefaultRequestHeaders ]),
json = Json.Document(source)
in
json;

DefaultRequestHeaders = [
#"Accept" = "application/json", // column name and values only
#"Content-Type" = "application/json", // we only support v4
#"api-auth-id" = "myAuthId",
#"api-auth-signature" = Crypto.CreateHmac(1,"myAuthKey", "1")
];

// Data Source Kind description
TripPin = [
Authentication = [
Anonymous = []
],
Label = "TripPin Part 1 - OData"
];

// Data Source UI publishing description
TripPin.Publish = [
Beta = true,
Category = "Other",
ButtonText = { "TripPin OData", "TripPin OData" }
];

Did you ever figure out how to do this?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.