Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Connector Development
Unanswered

Creating a Power Automate custom connector using Bearer Token

Like (0) ShareShare
ReportReport
Posted on 15 Dec 2021 15:39:21 by

Can offer some insight on what this should look like? Does the header in the definition need to have something? I found this solution but it does not work for me.

https://powerusers.microsoft.com/t5/Connecting-To-Data/Authorization-Bearer-in-Header-Custom-Connector/td-p/51541

 

  • sasrsc Profile Picture
    658 on 21 Jun 2024 at 12:16:39
    Re: Creating a Power Automate custom connector using Bearer Token

    @RamyEdrees  Can you provide the screenshots of your method too so I can better understand your version and compare with @gabeng 

    I will try @gabeng's method first but I wanted to try your method too and rather than waste hours trying to guess at how you solved it above, thought screenshots would help. Thanks 

  • gabeng Profile Picture
    32 on 11 Nov 2023 at 12:46:13
    Re: Creating a Power Automate custom connector using Bearer Token

    Authentication can be implemented in many different ways in APIs. Do you have information about what is required in your case? Is your API maybe public on PostMan (or can you make it public)?

    In my case the issue was not the generation of the Bearer Token, but its use in all subsequent API calls in a specific header parameter.

  • Clehoe Profile Picture
    2 on 09 Nov 2023 at 10:27:43
    Re: Creating a Power Automate custom connector using Bearer Token

    Hello i am currently facing the same issue is it possible to share some screenshots how you have done it?

    BR

  • RamyEdrees Profile Picture
    45 on 18 Aug 2023 at 03:54:29
    Re: Creating a Power Automate custom connector using Bearer Token

    Hi @gabeng ,

    First of all thank you so much for you prompt help and reply. I really appreciate it.

    I managed to solve my problem last night. I have used a different approach. I used Power automate to get the Bearer Token and then created another header in the API call and placed the bearer token there.. and finally got response 🙂

    Thank you again for your help and time..

    Have a wonderful day 

  • gabeng Profile Picture
    32 on 17 Aug 2023 at 17:09:56
    Re: Creating a Power Automate custom connector using Bearer Token

    Hi @RamyEdrees,

     

    to be clear: this is a dirty workaround because the (secret) API key must be provided as input to an action. One could improve this using Azure key vault, but I have not done that yet.

    Here a few screenshots:


    Authentication type remains empty:

    gabeng_0-1692291524775.png

     

    I implemented the function to generate the token manually:

    gabeng_1-1692291597182.png

    I specified two policies. One policy rewrites the "Origin" header (required by the external API I intend to use). In my case this policy must be applied also when generating the token:

    gabeng_2-1692291682005.png

    The second policy rewrites the "Authorization" header for every subsequent call after the token generation:

    gabeng_3-1692291770834.png

    Depending on the requirements of the external API that you intend to use, these policies may have to look different.

    An example flow would look like this:

    gabeng_4-1692292014981.png

    HTH.

  • RamyEdrees Profile Picture
    45 on 17 Aug 2023 at 08:28:17
    Re: Creating a Power Automate custom connector using Bearer Token

    Hi @gabeng,

    It seems that you were facing the same problem that I currently have. Do you mind sharing screenshot of all the steps in order to guide me in this? I am not a developer.. I am doing this for my family business

  • gabeng Profile Picture
    32 on 18 Feb 2023 at 12:04:08
    Re: Creating a Power Automate custom connector using Bearer Token

    I have the same issue with APIs that work with Bearer tokens. This post provided the answer for me:

    While you cannot set a request parameter with the name "Authorization" you may put the Bearer Token into a different header parameter and then use a Policy to rewrite this parameter into a parameter "Authorization". Now I am using a single Custom Conntector to

    • Create a Bearer Token using an authorization request which returns the Bearer Token,
    • Pass this Bearer Token to all subsequent calls of the Custom Connector as parameter "access-token" which is written to "Authorization" by a policy.

     

    https://powerusers.microsoft.com/t5/Using-Connectors/Authorization-Bearer-in-Header-Custom-Connector/m-p/1731788/highlight/true#M15803

     

    This is an additional list of http parameters that you would have to treat this way:

    https://learn.microsoft.com/en-us/azure/connectors/connectors-native-http#omitted-http-headers

     

    Unfortunately, the policies do not seem to be part of the json when exporting a Custom Connector.

  • husainsd Profile Picture
    2 on 12 Oct 2022 at 16:59:57
    Re: Creating a Power Automate custom connector using Bearer Token

    How can we dynamically pass the accesstoken to the connection in a POwer automate flow? I am fetching the token using a HTTP call and saving in a variable in my flow. How can i pass this parameter to the custom connector API Key parameter?

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Connector Development

#1
CG-07052056-0 Profile Picture

CG-07052056-0 20

#2
stampcoin Profile Picture

stampcoin 6

#3
CU17051452-1 Profile Picture

CU17051452-1 2

Overall leaderboard

Featured topics

Loading started