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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Best place to store be...
Power Automate
Answered

Best place to store bearer token

(0) ShareShare
ReportReport
Posted on by 21

Background:

I have a power app that uses many Power Automate Flows to make API calls to the same entity. I have a different flow for each type of API call that I need to make. Each API call requires the Bearer Token to be passed in the header. On each flow, I have a process that requests the Bearer Token. I store it in a variable then pass it in the header. All the API calls work but the problem is that the endpoint limits the number of bearer tokens issued per minute. The bearer token also expires after 60 minutes.

 

What I'd like to do is create a new flow that runs on a schedule (every 60 minutes) and securely stores the bearer token somewhere. Once a flow is ran, it retrieves the bearer token and passes it in the header of each API call. Is this a good way of doing this? If so, where is the best place to store the bearer token. I'm open to any and all ideas.

 

Here is what I'm doing now in all of my flows.

 

etuell_0-1649438927431.png

 

 

 

Categories:
I have the same question (0)
  • etuell Profile Picture
    21 on at

    An update to give a little more detail. I am currently storing the API client ID and secret in Azure Key Vault. I can retrieve the those items from Power Automate easily. I thought about storing the bearer token in Azure Key Vault as well but Power Automate does not seem to have native connector to create or update an object on the Azure Key Vault. 

     

    I would like to see what other people have done in this situation. Where do bearer token normally get stored?

  • Verified answer
    etuell Profile Picture
    21 on at

    I did find a solution that worked for me. I was able to follow this article https://www.c-sharpcorner.com/article/how-to-access-azure-key-vault-secrets-through-rest-api-using-postman/#:~:text=To%20do%20this%2C%20go%20to,case%20%E2%80%9CmyApp%E2%80%9D)%20%3D%3E

    and did all the testing in Postman. I then transferred everything from Postman into Power Automate. Here is how it's working now and it works great. This solution does require Premium HTTP actions which I have purchased a flow license for.

     

    • Power Automate Flow runs on a schedule (every 45 minutes)
    • Reaches to an API endpoint and get a bearer token and stores it in a variable. (this is the one I want to store in key vault)
    • Reaches out to Microsoft and gets a bearer token
    • Uses Microsoft's bearer token to connect to the Azure Key Vault
    • Sets the secret's value ( I used this article - https://docs.microsoft.com/en-us/rest/api/keyvault/secrets/set-secret/set-secret)

    All of my flows now get the Bearer Token from the key vault instead of getting it on every API call.

     

  • Paulhins8675309 Profile Picture
    2 on at

    Interesting solution. Does this work with a Power BI gateway so that you can use the bearer tokens to access APIs through functions and headers in Power BI transformations? 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 86 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 55

#3
Ellis Karim Profile Picture

Ellis Karim 53 Super User 2026 Season 1

Last 30 days Overall leaderboard