Get Bearer Token in Power Automate Flow

8 Comments

In this post, we will look at how to get a Bearer token in a Power Automate flow.

First, we will create a new Instant flow in Power Automate:

And we will trigger it manually:

Now let’s add a new HTTP connector:

Now, following along from a previous post where we get the Bearer token to use in Postman, we will set the method = POST and the URI = the microsoftonline URI with our tenant:

Now, for the Header, the Content-Type = application/x-www-form-urlencoded, and the Body will contain a string in the format grant_type=client_credentials&client_id={clientid}&client_secret={clientsecret}&resource={resource}:

When we run this, we see we get back the Bearer token:

 

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

8 Responses to Get Bearer Token in Power Automate Flow

  1. This is working successfully for us, but we need to get a token on behalf of a user. Is there a pattern you have worked with to pass in the user context that is executing the flow – On behalf of a user?

  2. Could you please tell us more on where should I put in the details like access_Token, token type, expires-in in the body of the HTTP request? is it going to be picked up automatically based on URI? I dont have resource value data.

  3. Hi
    How can I grab the access token from the body and put it in a variable?
    Next step in my flow I would like to use this token in another http request

Leave a Reply

Your email address will not be published. Required fields are marked *