Basically the title.
I have an on-premises HTTP endpoint that I'd like to pass a Bearer token into using the Authorization header. The only problem is this is apparently not supported via the on-premises gateway. I was able to work around this but I don't know how to make this work long term, see below:
In this image you can see that Authorization is a non-allowed header unless I select API Key... which is unavailable with on-premise data gateway selected.
The way around this (for just a test anyway) was to use a policy that writes the Authorization header on Request. Is there a way to make this more dynamic so I can use it in a flow?
Solved! Go to Solution.
You are very close. The set http header takes connection parameter. So define a connection parameter which will be populated during connection creation and will be used by set http header.
https://docs.microsoft.com/en-us/connectors/custom-connectors/policy-templates/setheader/setheader
If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.
You are very close. The set http header takes connection parameter. So define a connection parameter which will be populated during connection creation and will be used by set http header.
https://docs.microsoft.com/en-us/connectors/custom-connectors/policy-templates/setheader/setheader
If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.
Could you post an example? Sorry, I don't understand the documentation linked. I will continue to try and figure this out in the meantime...
Unfortunately, after a month of trying to figure this out I am no closer. I don't know how to define a connection parameter; I've looked at the linked documentation probably a thousand times now trying to comprehend the examples. Screenshot examples would be very helpful!
After watching a YouTube video I was able to figure it out, you were right but as someone who has never done this before it wasn't clear.
039 - Dynamically Changing Power Automate Custom Connector Values using Policy Templates - YouTube
if the Power Apps user authenticates on the on premises server using OAuth2 Code, then the authorization header is generated by PowerApps with the access token.
How can we authenticate on the On premises server using Oauth2? This type of authentication is not listed in the custom connector when On premises gateway is chosen.
Is there an alternative way to achieve Oauth2 authentication?
I think you would need to use Microsoft Edge Developer tools (the Network tab) to identify then copy your request payload at the time of login. You'd use "No Authentication" for the security step on the custom connector though. For the OAuth2 its probably just a JSON response you'd put in the body that contains a bunch of details related to you. As far as I can tell, it works and its reusable, but you'd probably want to use a "service account" and not do this with your personal work account in case you ever leave...
I could not be 100% right but I think this is the gist of it...
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.