Forum Discussion
Power Query custom connector with combined authentication types
- 11 months ago
Hi jnickell , Thank you for reaching out to the Microsoft Community Forum.
Extension.CurrentCredential() can only return one credential record at a time, even though VS Code shows both UsernamePassword and Key stored. The connector runtime won’t merge them, so you can’t directly retrieve both Password and Key from the same call. That’s why your current approach fails. Greg_Deckler was right that you could hardcode the API key, but that weakens security. vojtechsima correctly said, you should either stick with Dataflows (where credentials are already protected in the service and hidden from end users) or move to Fabric Notebooks/Pipelines with Key Vault for stronger enterprise security.
If you do want to continue with a connector, the usual pattern is to define a single authentication kind and pass the API key as a required parameter that you inject into the request header. That way you avoid mixing credential types, which isn’t supported. You weren’t wrong in thinking about connectors, but you’re not as exposed as you feared with Dataflows, they already give you a decent security boundary.
jnickell Well, this will depend on how the API works but what I am thinking is that you need to skip the AuthenticationKind Key and essentially hard-code your API Key in the custom connector and then just include it as necessary in the request header. But, without more information about what API you are trying to connect to it's a complete guess. Note that I have found success using ChatGPT to point it to an API's documentation and generate the custom connector code for me. Generally only requires a bit of tweaking to get it working. Something you might try.
Hi Greg_Deckler ,
The docs for the API are here: https://secure6.saashr.com/ta/docs/rest/public/, but they don't make the 'v1' immediately obvious, but I think this takes you there: https://secure6.saashr.com/ta/docs/rest/public/?r=__v1__login#post
I think the larger part of my question is how or if you can store multiple types of credentials in a custom connector and retrieve them. I'm not seeing the documentation spell this out, but again I'm new to this part of PowerQuery.
- Greg_Deckler11 months agoCommunity Champion
jnickell Well, if it is an API key, you just store it as text in a file that is part of the connector. I mean, you can. Not the safest obviously.
- jnickell11 months agoHelper V
I guess this is more secure than storing the entire credential set in PQ service. Was hoping I could say I had fully banished this one security hole by implementing a connector.