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.
Solved! Go to Solution.
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-p...
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.
All of my flows now get the Bearer Token from the key vault instead of getting it on every API call.
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?
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-p...
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.
All of my flows now get the Bearer Token from the key vault instead of getting it on every API call.
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?
User | Count |
---|---|
16 | |
16 | |
14 | |
9 | |
8 |
User | Count |
---|---|
29 | |
28 | |
24 | |
23 | |
13 |