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

"x-ms-failure-cause" : "apihub-token-exchange",

I'm integrating my personal app with Microsoft Flow.

When I try to receive a file content (example: Flow that creates a new document inr my app storage everytime a file is added to OneDrive) it retrives this error:

"x-ms-failure-cause": "apihub-token-exchange"Capture.PNG

 

 What am I doing wrong?

13 REPLIES 13
Community Support Team
Community Support Team

Re: "x-ms-failure-cause" : "apihub-token-exchange",

Hi Fvamaro,

 

You said that you are integrating your personal app with Microsoft Flow, so which app are you using?


How is your flow configured?


Could you show me a screenshot for your flow to help reproduce this issue on my side?


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Fvamaro
Level: Powered On

Re: "x-ms-failure-cause" : "apihub-token-exchange",

Hi @v-yamao-msft

There you have my flow:

Att1.PNG

However, when an email is flagged, Flow returns the error:Att2.PNG

 

 

Att3.PNG

 

 

Att4.PNG
Att5.PNG

 

 

 

 

 

 

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

Hi,

I have exactly the same issue. From my Flow I am using my custom connector to make an API call. Testing within the connector works just fine without any errors using the same connection as configured in the Flow. But when the Flow is running I get this Bad Request with the same error. Very curious what's going on and to solve it.

 

grtz,

Octavie

Fvamaro
Level: Powered On

Re: "x-ms-failure-cause" : "apihub-token-exchange",

@Octavie are you working with files too?

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

No, not working with OneDrive files or so. I have developed an Azure Web API, that needs to be called from the Flow. For that, I needed to create a custom connector.

 

ApiError.png

 

I very much followed this article: https://powerapps.microsoft.com/nl-nl/blog/custom-api-with-authentication/ 

grtz,

Octavie

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

Somehow I keep thinking it's about the account that I use for the connection. I have a dedicated service account for this, while I am editing the Flow using my own account. Maybe I need to investigate this more...

 

I'll keep you posted.

 

Octavie

Fvamaro
Level: Powered On

Re: "x-ms-failure-cause" : "apihub-token-exchange",

@Octavie I'm using 2 different accounts too.

 

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

Wow. Just wow. How misleading is this error message. It seems my API does get called, because I see my logging information show up in Application Insights (Azure service). At some point it has logged a 403 forbidden exception, which means my service account is missing some permissions 🙂 #AlmostGotMyNeedleInTheHaystack

ApiError2.png

 

 

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

Solved it. So, in my case it was the missing Permission piece. Once I set the required permissions for the service account I used in the connection, the Flow finished successfully. 🙂 I do hope you can solve yours as well very soon!

ApiError3.png

 

 

Fvamaro
Level: Powered On

Re: "x-ms-failure-cause" : "apihub-token-exchange",

What have you done to solve it? @Octavie

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

@FvamaroFrom your custom connector, when you go to the Test tab, can you successfully execute your action from there using the same connection you are using in the Flow?

ApiError4.png

 

 

Fvamaro
Level: Powered On

Re: "x-ms-failure-cause" : "apihub-token-exchange",

No, retrives error 500 @Octavie

Octavie
Level: Power Up

Re: "x-ms-failure-cause" : "apihub-token-exchange",

So, 500 means, you can connect, authentication goes fine, but executing some code (?) within that component fails. It throws the InternalServerException.... You need to debug it more to find your needle. Keep testing it from the connector, before using the complete Flow...

Good luck!

 

Octavie

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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 Kudoed Authors (Last 30 Days)
Users online (4,806)