cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mick282
Level: Powered On

OAuth 2 how to re-authenticate/refresh an expired token

Hi all,

 

So I've managed to setup a O-Auth2 Power Automate function that will automatically use credentials to retrieve and return a access token. This Flow can be called by other Flows so long as they pass the credentials to it.

 

image.png

 

Now this works perfectly and the access token can be used to make API requests to the designated endpoint. The question is that the token only lasts 20 minutes and the returned access token also contains a line that indicates in seconds when it will expire. Is there a way to use this to setup a auto-refresh of the token if another Flow that's using this function takes longer than 20 minutes to call?

 

image.png

2 REPLIES 2
Highlighted
Community Support Team
Community Support Team

Re: OAuth 2 how to re-authenticate/refresh an expired token

Hi @Mick282,

 

You could create a Do-Until action to put these actions into it, for we could control the recall times, we could initialize a integer variable before it, for example:Annotation 2019-11-27 151428.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Mick282
Level: Powered On

Re: OAuth 2 how to re-authenticate/refresh an expired token

Thanks @v-litu-msft .

 

That's a good idea. How would this work from a perspective of updating the access token on a calling flow?

 

My flow used to get the access token is just a function that a second Flow uses to get the access token to then perform a action. Below is the second flow that actually performs an API action once it has retrieved the access token.

 

image.png

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (6,783)