<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic OAuth2 authorization code flow not returning refresh_token — mobile users re-prompted for credentials every 30 minutes in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/oauth2-authorization-code-flow-not-returning/m-p/1697100#M68453</link>
    <description>&lt;P&gt;We have a server-side web application that authenticates users via ArcGIS Online using the OAuth 2.0 authorization code flow. Our backend exchanges the authorization code for an access token, caches it server-side (Azure Functions + Azure Table Storage), and uses it to make feature service calls on behalf of the user. On initial login the flow works correctly.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The problem:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Users on mobile browsers (e.g. Chrome on Android) are prompted to re-enter their ArcGIS username and password every ~30 minutes when the access token expires. Desktop browser users do not experience this — when the token expires on desktop, ArcGIS silently re-authenticates via the existing browser session and a new token is issued without the user being prompted.&lt;/P&gt;&lt;P&gt;We believe the difference is that desktop users maintain an active ArcGIS Online browser session (cookie) which allows silent re-authentication, whereas mobile users do not have this persistent session. The correct solution for mobile is therefore refresh tokens, which would allow our backend to silently renew the access token without any browser interaction at all.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;What we have implemented:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Our backend includes silent token refresh logic using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=refresh_token. We also send&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expiration=20160&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the authorize URL per the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/authorize/" target="_blank" rel="noopener noreferrer"&gt;/authorize documentation&lt;/A&gt;, which should set a 2-week refresh token lifetime.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The issue:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;The token exchange response for&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=authorization_code&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;does not include a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;refresh_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field at all. Without it our silent refresh cannot work and mobile users are forced through the full login flow every 30 minutes.&lt;/P&gt;&lt;P&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/token/" target="_blank" rel="noopener noreferrer"&gt;/token documentation&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;explicitly states:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;refresh_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;— ONLY returned when&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=authorization_code&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=exchange_refresh_token&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Our token exchange request:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;POST &lt;A href="https://www.arcgis.com/sharing/rest/oauth2/token" target="_blank" rel="noopener"&gt;https://www.arcgis.com/sharing/rest/oauth2/token&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;client_id=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;client_secret=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;grant_type=authorization_code&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;code=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;redirect_uri=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The response contains&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;access_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expires_in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(1800 seconds) but no&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;refresh_token.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Our question:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is there an ArcGIS Online organisation-level setting or OAuth application registration setting that controls whether refresh tokens are issued? Our app is registered as "OAuth 2.0 Credentials" (not "Impersonates item owner"). We have not been able to find any setting in the app registration UI that enables refresh tokens.&lt;/P&gt;&lt;P&gt;Any guidance appreciated.&lt;/P&gt;</description>
    <pubDate>Sat, 18 Apr 2026 10:52:32 GMT</pubDate>
    <dc:creator>NigelCharman</dc:creator>
    <dc:date>2026-04-18T10:52:32Z</dc:date>
    <item>
      <title>OAuth2 authorization code flow not returning refresh_token — mobile users re-prompted for credentials every 30 minutes</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/oauth2-authorization-code-flow-not-returning/m-p/1697100#M68453</link>
      <description>&lt;P&gt;We have a server-side web application that authenticates users via ArcGIS Online using the OAuth 2.0 authorization code flow. Our backend exchanges the authorization code for an access token, caches it server-side (Azure Functions + Azure Table Storage), and uses it to make feature service calls on behalf of the user. On initial login the flow works correctly.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The problem:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Users on mobile browsers (e.g. Chrome on Android) are prompted to re-enter their ArcGIS username and password every ~30 minutes when the access token expires. Desktop browser users do not experience this — when the token expires on desktop, ArcGIS silently re-authenticates via the existing browser session and a new token is issued without the user being prompted.&lt;/P&gt;&lt;P&gt;We believe the difference is that desktop users maintain an active ArcGIS Online browser session (cookie) which allows silent re-authentication, whereas mobile users do not have this persistent session. The correct solution for mobile is therefore refresh tokens, which would allow our backend to silently renew the access token without any browser interaction at all.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;What we have implemented:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Our backend includes silent token refresh logic using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=refresh_token. We also send&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expiration=20160&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the authorize URL per the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/authorize/" target="_blank" rel="noopener noreferrer"&gt;/authorize documentation&lt;/A&gt;, which should set a 2-week refresh token lifetime.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The issue:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;The token exchange response for&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=authorization_code&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;does not include a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;refresh_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field at all. Without it our silent refresh cannot work and mobile users are forced through the full login flow every 30 minutes.&lt;/P&gt;&lt;P&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/token/" target="_blank" rel="noopener noreferrer"&gt;/token documentation&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;explicitly states:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;refresh_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;— ONLY returned when&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=authorization_code&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=exchange_refresh_token&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Our token exchange request:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;POST &lt;A href="https://www.arcgis.com/sharing/rest/oauth2/token" target="_blank" rel="noopener"&gt;https://www.arcgis.com/sharing/rest/oauth2/token&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;client_id=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;client_secret=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;grant_type=authorization_code&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;code=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;redirect_uri=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The response contains&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;access_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expires_in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(1800 seconds) but no&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;refresh_token.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Our question:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is there an ArcGIS Online organisation-level setting or OAuth application registration setting that controls whether refresh tokens are issued? Our app is registered as "OAuth 2.0 Credentials" (not "Impersonates item owner"). We have not been able to find any setting in the app registration UI that enables refresh tokens.&lt;/P&gt;&lt;P&gt;Any guidance appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2026 10:52:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/oauth2-authorization-code-flow-not-returning/m-p/1697100#M68453</guid>
      <dc:creator>NigelCharman</dc:creator>
      <dc:date>2026-04-18T10:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth2 authorization code flow not returning refresh_token — mobile users re-prompted for credentials every 30 minutes</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/oauth2-authorization-code-flow-not-returning/m-p/1697115#M68454</link>
      <description>&lt;P&gt;SOLVED! We initially thought we weren't receiving a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;refresh_token&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;at all, but this turned out to be a bug in our own diagnostic tooling. The actual fix was adding&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expiration=20160&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;/oauth2/&lt;/SPAN&gt;&lt;SPAN class=""&gt;authorize&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;URL:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&lt;A href="https://www.arcgis.com/sharing/rest/oauth2/authorize" target="_blank" rel="noopener"&gt;https://www.arcgis.com/sharing/rest/oauth2/authorize&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;?client_id=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&amp;amp;response_type=code&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&amp;amp;redirect_uri=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&amp;amp;state=...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&amp;amp;expiration=20160&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Per the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/authorize/" target="_blank" rel="noopener noreferrer"&gt;/authorize documentation&lt;/A&gt;, for authorization code grants&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expiration&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;controls the refresh token lifetime, not the access token (which is always capped at ~30 minutes). Without it, ArcGIS was not issuing a refresh token.&lt;/P&gt;&lt;P&gt;With a refresh token in hand, our backend silently renews the access token on expiry using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;grant_type=refresh_token, so mobile users are no longer prompted for credentials every 30 minutes.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2026 20:30:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/oauth2-authorization-code-flow-not-returning/m-p/1697115#M68454</guid>
      <dc:creator>NigelCharman</dc:creator>
      <dc:date>2026-04-18T20:30:40Z</dc:date>
    </item>
  </channel>
</rss>

