cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Authorization header using HTTP via on-premise datagateway?

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.

thumbnail_image.png

 

thumbnail_image (1).png

 

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?

thumbnail_image (2).png

1 ACCEPTED SOLUTION

Accepted Solutions
Syndicate_Admin
Administrator
Administrator

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 👍.

View solution in original post

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

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!

Syndicate_Admin
Administrator
Administrator

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

debugging
Regular Visitor

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...

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (3,288)