Skip to main content

Notifications

Power Automate - Connector Development
Unanswered

How to view logs of OAuth2 refresh token request from Custom Connector???

(0) ShareShare
ReportReport
Posted on by 1,020

We have an OAuth2 Postman v2.1 collection imported into a custom connector, and it works perfectly! ...for 20 minutes.

After 20 minutes the access token expires and we see an error when viewing the connection details:

Failed to refresh access token for service: oauth2. Correlation Id=..., UTC TimeStamp=12/13/2021 11:26:20 PM, Error: OAuth 2 access token refresh failed. Client ID and secret sent in form body.. Response status code=BadRequest. Response body: {"error":"invalid_grant"}


This error message is not super helpful. We need to see the actual request that returns this error.

How can we see the logs of the OAuth2 authorization code flow requests and refresh token requests made internally and automatically by our custom connector?


See full post here:
Custom Connector successfully performs OAuth2 auth... - Power Platform Community (microsoft.com)

FWIW, we have the exact same configuration working with the QuickBooks Online API. This other API that fails on refresh contains an extra parameter in the auth code flow POST response body called "claims", which is a long, triple-backslash-escaped, JSON-formatted string with several parameters of its own. We believe this API is following the REST API spec and OAuth2 spec, and that they are not doing anything invalid. We believe that Power Platform custom connectors must have some incompatibility with this "claims" JSON object string. It occurs right after the "refresh_token" parameter in the response body, so maybe something to do with the triple-backslash escapes breaking out of the parser?

Somehow our custom connector is sending a malformed refresh token request and we absolutely must see logs of that request to sort out what's going wrong. We are fairly certain this is a Microsoft bug and not a mistake on our part or a problem with the 3rd party API. That 3rd party API is used by thousand if not millions of people, and no one else is reporting this problem. Turns out that we are the very first users to try to integrate that API in a Power Platform custom connector, so that right there tells you that it's probably a Microsoft problem.

Any thoughts appreciated!

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard

Featured topics