I'm currently developing a Custom Data Connector with the PKCE OAuth2 flow.
We are having some strange issues during a data refresh when an expired access_token is provided.
From Fiddler, we can see that the initial exchange for a new token occurs successfully. But shortly thereafter, multiple calls are made to the /token endpoint using the old refresh_token. It appears that the number of subsequent calls correlates to the number of queries/tables used.
Navigating to the Connector/Navigator window will correctly refresh the token too if the access_token
From the screenshot, you can see a successful call to the endpoint for that single thread.
From Power BI Desktop, the user will be presented the SignIn/Credentials window with the error "The credentials provided are invalid" for every query in the refresh (if they selected cancel).
The subsequent data refresh will now work as the new tokens have been stored correctly from that first successful exchange.
However this is not the case for when the on-premises gateway is used.