# Microsoft PowerApps OAuth 2.0 Code Grant Flow Issues

**URL:** <https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837>\
**Category:** Ask the Community\
**Tags:** authentication\
**Created:** [July 25, 2024, 8:44pm UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837 "2024-07-25T20:44:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenHodde-Selkirk](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/benhodde-selkirk/32/968_2.png) [@BenHodde-Selkirk](https://community.palantir.com/u/BenHodde-Selkirk)\
**Post date:** [July 25, 2024, 8:44pm UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/1 "2024-07-25T20:44:53Z")

</div>

We were able to set up a custom connector on the Microsoft Power Platform that utilizes the OAuth 2.0 flow to authenticate with Foundry as a third party app. It works great for connecting to Foundry Ontology object types and action types. The trouble, unfortunately, is that our authorization token is expiring after an hour, and we have to manually re-authorize the application.

It seems that there should be automatic handling of the refresh token when the access token expires. Other connections we have created using this same authentication method do not require us to re-authorize, as the refresh is handled by the backend APIM service.

Is there a scope or configuration setting somewhere on either side I am missing that would make this work properly? Its great in testing, but in production this hour timeout would make it less that useful to our business end users.

---

<div class="post-metadata">

**Author:** ![nicornk](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/nicornk/32/192_2.png) [@nicornk](https://community.palantir.com/u/nicornk)\
**Post date:** [July 26, 2024, 4:53am UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/2 "2024-07-26T04:53:41Z")

</div>

Did you request scope offline\_access in the authorization code grant? Only than a refresh token is returned.

Edit: We do have a similar issue in Tableau, where Tableau is not able to refresh the Foundry token in the backend. This is due to Foundry Multipass Team interpreting the oauth2 spec more strictly than other providers - once a new refresh\_token is provided, the old refresh\_token will be invalidated more or less immediately.

I can imagine that PowerAutomate can also not work with that strict interpretation…

---

<div class="post-metadata">

**Author:** ![BenHodde-Selkirk](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/benhodde-selkirk/32/968_2.png) [@BenHodde-Selkirk](https://community.palantir.com/u/BenHodde-Selkirk)\
**Post date:** [July 29, 2024, 9:01am UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/3 "2024-07-29T09:01:32Z")

</div>

Thanks for the response, it was indeed the lack of the offline\_access scope that prevented our refresh from working as expected. We noticed this in the docs, but implemented it incorrectly, upon more careful inspection.

Testing this morning, the refresh is working properly with PowerApps.

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [January 6, 2025, 3:24am UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/4 "2025-01-06T03:24:31Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [June 23, 2025, 8:20am UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/5 "2025-06-23T08:20:29Z")

</div>



---

<div class="post-metadata">

**Author:** ![Flackermann](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/flackermann/32/612_2.png) [@Flackermann](https://community.palantir.com/u/Flackermann)\
**Post date:** [June 25, 2025, 8:42am UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/6 "2025-06-25T08:42:09Z")

</div>

Is this working with authorization code grant or only client credentials?

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [August 22, 2026, 12:23pm UTC](https://community.palantir.com/t/microsoft-powerapps-oauth-2-0-code-grant-flow-issues/837/7 "2026-08-22T12:23:14Z")

</div>


