Skip to main content

Notifications

Power Automate - Connector Development
Answered

Authorization header using HTTP via on-premise datagateway?

(0) ShareShare
ReportReport
Posted on by 626

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

Categories:
  • LB-21081025-0 Profile Picture
    LB-21081025-0 2 on at
    Authorization header using HTTP via on-premise datagateway?
     Appreciate your verified answerdlprentice ! 

    I am not able to see your last posted .pngs. Could you repost these pictures if possible? :-)
     
    Thanks in advance
     
  • lsheltonSTO1 Profile Picture
    lsheltonSTO1 113 on at
    Re: Authorization header using HTTP via on-premise datagateway?

    Thank you SO MUCH for coming back to post this - I'm one of the someones you saved a lot of time for!

  • Verified answer
    dlprentice Profile Picture
    dlprentice 626 on at
    Re: Authorization header using HTTP via on-premise datagateway?

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

     

    dlprentice_0-1675351063793.png

     

    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.

     

    dlprentice_1-1675351122875.png

     

    dlprentice_2-1675351138260.png

    Make a new policy.

     

    dlprentice_3-1675351159427.png

     

    Make sure your policy looks something like this...

     

    dlprentice_5-1675351210081.png

     

    Save and test.

     

    dlprentice_6-1675351356343.png

     

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

     

    dlprentice_7-1675351390728.png

     

    Hope this saves someone a lot of time!

  • dlprentice Profile Picture
    dlprentice 626 on at
    Re: Authorization header using HTTP via on-premise datagateway?

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

  • Dinesh Profile Picture
    Dinesh 62 on at
    Re: Authorization header using HTTP via on-premise datagateway?

    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?

  • dlprentice Profile Picture
    dlprentice 626 on at
    Re: Authorization header using HTTP via on-premise datagateway?

    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

  • dlprentice Profile Picture
    dlprentice 626 on at
    Re: Authorization header using HTTP via on-premise datagateway?

    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"

  • dlprentice Profile Picture
    dlprentice 626 on at
    Re: Authorization header using HTTP via on-premise datagateway?

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

  • Verified answer
    murshed Profile Picture
    murshed on at
    Re: Authorization header using HTTP via on-premise datagateway?

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard

Featured topics