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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

How do I solve user API credentials in a report?

I´m doing a Power Bi report that use data from a API. I have done a table with the credentials to the API, username, password and subscriptionkey. The first question to all tables with data is to get the token from the API so I can ask the question correct. Looks like this in my table and the advanced editor:

"

Url = Text.Format("https://api.hey.com/fun/authentication/login?username=#{0}&password=#{1}",{#"UserIdFile", Uri.EscapeDataString(#"PasswordFile")}),
TokenSource = Json.Document(Web.Contents(Url, [Headers=[#"Ocp-Apim-Subscription-Key"=SubscriptionKey]])),
userCode = TokenSource[userCode],
Ask = Text.Format("https://api.hey.com/fun/v1/machines/#{0}/history/utilization?start=#{1}&end=#{2}&expand=1", {#"MachineId", #"startDate", #"endDate"}),
Source = Json.Document(Web.Contents(Ask, [Headers=[#"X-Auth-Token"=userCode, #"Ocp-Apim-Subscription-Key"=SubscriptionKey]])),

"

My table with the credentials looks like this:

creds.JPG

One row with my username, password and sub key.

When I refresh the reports everything works fine and I get new data.

 

But now the tricky part starts 🙂

My user of this reports when I publish them need to be able to update the credentials with their own ones. 

 

How do I solve that?

 

I have looked into using PowerApps with edit forms and other ways. I´m not a super user of PowerBi and PowerApps so maybe I have done something wrong....

1 REPLY 1
JirkaZ
Solution Specialist
Solution Specialist

@Anonymous This can only be done using Power Query extension (and thus creating a custom connector for the API). 
https://docs.microsoft.com/en-us/power-query/handlingauthentication

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.