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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.