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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Custom Data Connector Prompt Credentials

Hey guys,
I'm building a custom data connector to gets data from an Rest API that doesn't support OAuth, and i was wondering if it is possible for the user to be prompted for some info, like the Base_Url and an Auth_Key on the first use, and then store that info in a text file. Then the connector would read from that file everytime. The prompt could always appear, but if it was pre-filled, that would be awesome.

I made the part that reads from the text file, but i can't figure out a way to make the "user input first" approach, work.
Is there any way to make that using the credentials part of the connector, maybe?
My connector logic is:

GetTable = (ID as text, Params as text) as table =>
    let
        authKey = LoadFromResource("Auth_Key"), // file Auth_Key.txt
        url =  LoadFromResource("BaseUrl") & "?id=" & ID & "&params=" & Params, // file BaseUrl.txt
        options = [Headers=[auth_key= authKey, #"Content-Type"="application/Json"]], 
        source = Json.Document(Web.Contents(url, options)),
        toRecords = Table.FromRecords(source),
        expanded = ExpandAllRecords(toRecords)
     in
        expanded;

[DataSource.Kind="Test1", Publish="Test1.Publish"]
shared Test1.Contents = (ID as text, Params as text) => 
     let    
          source = GetTable(ID, Params)
     in
          source;

 Thank you.

3 REPLIES 3
Anonymous
Not applicable

You can create an argumented function to get the url as a parameter. Example:

 

Thisisthefunction = (url as text) =>

 

let 

source = Web.Contents(url)

in 

source

Anonymous
Not applicable

Update: i figured out how to prompt only once for the auth_key:

authKey = Extension.CurrentCredential()[Key] 

Instead of that LoadFromResource. This way it prompts the user for the key on the first time, and then it stores in PBI, even if you clean the cache.

You have to change this aswell:

Teste1 = [
    Authentication = [
        Key = 
[
            Label = " "
] 
    ],
    Label = Extension.LoadString("DataSourceLabel")
];

Now i'll keep trying for the Base URL.

Anonymous
Not applicable

Hi did you find any method to pass url as parameter

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.