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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.