web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Creating a Power Autom...
Power Apps
Unanswered

Creating a Power Automate custom connector using Bearer Token

(0) ShareShare
ReportReport
Posted on 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

 

Categories:
I have the same question (0)
  • husainsd Profile Picture
    2 on at

    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?

  • gabeng Profile Picture
    32 on at

    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.

  • RamyEdrees Profile Picture
    45 on at

    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 at

    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 at

    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 

  • Clehoe Profile Picture
    2 on at

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

    BR

  • gabeng Profile Picture
    32 on at

    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.

  • sasrsc Profile Picture
    678 on at

    @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 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard