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?
Thank you SO MUCH for coming back to post this - I'm one of the someones you saved a lot of time for!
Hi all,
I really felt like I needed to follow up on this since it's still unclear after re-reading this post. I mean it's clear to me, but I will post some screenshots and explain.
When you select "No authentication" but still want to send an Authorization header with a Bearer token here is how you do it...
On the request have a header that you will act as the Authorization header. I have a header called "Header" that will become the Authorization header through a policy.
Make a new policy.
Make sure your policy looks something like this...
Save and test.
Yay! We got a response! In this particular situation I just copied my token from the Microsoft Graph API explorer just to demonstrate. You'd have to either register your application in Azure or find out some clever way to get tokens. This simply demonstrates how to send the Authorization header when your security is set to "No authentication".
Hope this saves someone a lot of time!
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...
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?
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
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!
To be clear I am using "No authentication"
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...
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 👍.