cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CantStopTheFlow
New Member

Call REST api in Flow with grant_type

The endgoal is to hit an external API, return data, and populate a SharePoint list... all using the FLOW IDE.

 

The first hurdle is getting an Access Token from the API. Their instructions state:

 

"To make a REST API call, you must include request headers including the Authorization header with an OAuth 2.0 access token. To get an access token, pass the [ApiClientKey]:[ApiClientSecret] credentials to the Authorization Server in base64 format in the Authorization header in a get access token request.
To make a REST API call, you must include request headers including the Authorization header with an OAuth 2.0 access token. "

 

I have obtained the Key:Secret, and generated the base64 format of it.

 

Their sample code is:

---Code Start---
POST /auth/token HTTP/1.1
Host: restapi.CompanyX.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic [base64 Keysecret]
Cache-Control: no-cache

grant_type=client_credentials

--- Code End ---

 

The problem that I'm having with Flow is: How to implement the grant_type=client_credentials?? 

 

The Flow screen for an HTTP has the Headers sections, and it seems obvious that everything that is colon separated would go there. But where does the grant_type get placed?  Does it go in the Headers, Queries, or Body section, and how is it formatted? Also does the Method parameter need the "/auth/token HTTP/1.1"

 

TIA,

 

Flow Rookie

 

Pic for Reference:

FlowHelp1.pngFLOW HTTP Command

 

 

 

 

 

 

3 REPLIES 3
Super User
Super User

Re: Call REST api in Flow with grant_type

Hi @CantStopTheFlow 

 

You can try that grant_type as part of header. 

 

Another option is try to create a Flow custom connector.

 

Please see this post regarding custom connector where it uses client id and client secret OAuth 2.0

 

https://powerusers.microsoft.com/t5/Connecting-To-Data/Custom-connector-Oauth-problem-CORS/m-p/50454...

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
CantStopTheFlow
New Member

Re: Call REST api in Flow with grant_type

With a little more research, I believe that it is not possible to implement the use of grant_type. This is based on these other forum posts:

 

It appears to be a functionality oversight, with no resolution in sight. 

 

Thus, neither of your suggestions are valid.

Super User
Super User

Re: Call REST api in Flow with grant_type

Hi @CantStopTheFlow 

 

Thanks for your reply. Have you got all the below information and try in a custom connector and see what error you are getting?

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (6,278)