MS Flow - Get Data From 3rd Party Application Using Client ID And Client Secret In REST API

In this post, I am using REST API to get the feed from a 3rd party application using client ID and client secret.
 
Before that, you need to already have Client ID and Client Secret which we are going to use in the API call. We are making two calls here. The first call is to fetch the access token and the second call will be using the access token we got in step one. 
 
Overall Flow View
 
MS Flow - Get data From 3rd Party Applicaion Using ClientID And Client Secret In REST API
Steps
  1. Create flow from a blank template using the item created or modified in the list.
  2. Initialize the variables as Client ID and Client Secret.

    MS Flow - Get data From 3rd Party Applicaion Using ClientID And Client Secret In REST API

  3. Add HTTP as an action event and configure as shown.

    We have used POST request which will provide us with an access token which we are going to use in a later step.

    MS Flow - Get data From 3rd Party Applicaion Using ClientID And Client Secret In REST API

    The concatenation formula should contain the below text.
    1. concat('grant_type=client_credentials&client_id=', variables('ClientId'), '&client_secret=', variables('ClientSecret'))  
  4. Add Parse JSON as next action because this will be parsing the records. In the content, you need to add Body as content from the HTTP Request.

    MS Flow - Get data From 3rd Party Applicaion Using ClientID And Client Secret In REST API
    Add the below text as Schema.
    1. {  
    2.     "type""object",  
    3.     "properties": {  
    4.         "access_token": {  
    5.             "type""string"  
    6.         }  
    7.     }  
    8. }  
  5. Add HTTP action for getting the feed records.

    MS Flow - Get data From 3rd Party Applicaion Using ClientID And Client Secret In REST API
Here, we have selected access_token under Authorization from the PARSE JSON step. 
 
Under Headers, we have to put
  • contentType:application/json; charset=utf-8
  • Authorization:Bearer @{body('Parse_JSON')?['access_token']} 
This will return all the feeds based on the parameters you passed.
 
Cheers!!