Trying to call the Power Automate API manually without success. Has anyone been able to do it?
Generating Token works in general, but the resulting token doesn't work to authenticate the call to the actual endpoint:
{
"error": {
"code": "InvalidAuthenticationTokenAudience",
"message": "The access token has been obtained from wrong audience or resource '00000002-0000-0000-c000-000000000000'. It should exactly match (including forward slash) with one of the allowed audiences 'https://service.flow.microsoft.com/','https://management.core.windows.net/','https://management.azure.com/','https://service.powerapps.com/','https://service.kratosapps.com/','637fcc9f-4a9b-4aaa-8713-a2a3cfda1505'."
}
}What I have tried is this POST request:
{
"inputs": {
"method": "POST",
"uri": "https://login.microsoftonline.com/<myTenantID>/oauth2/v2.0/token",
"headers": {
"content-type": "application/x-www-form-urlencoded"
},
"body": "Client_Id=xxx&Client_Secret=xxxx&grant_type=client_credentials&scope=https://service.flow.microsoft.com/.default"
}
}{
"inputs": {
"method": "GET",
"uri": "https://emea.api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/<myEnvironment>/flows/<myFlowID>/runs?api-version=2016-11-01",
"headers": {
"Authorization": "Bearer @{body('Parse_JSON')?['access_token']}"
}
}
}The app/service principal has "Flows.Manage.All"-permissions.
The custom connector runs without any issues with these credentials - just that it cannot handle pagination, so I have to do it manually instead...
Also, the working custom connector is using "https://service.flow.microsoft.com/" as Resource URL.