<?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 Re: AccessTokenCredential CreateAsync throws exception when accessing resources in federated server in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674607#M13821</link>
    <description>&lt;P&gt;Also, when I'm signed into a portal, and access a token-secured resource from a server that's federated with the portal I'm signed into. It's not automatically re-using my portal credentials for the server. Instead the ChallengeHandler calls CreateCredentialAsync for me to generate a new one.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Dec 2025 23:14:28 GMT</pubDate>
    <dc:creator>EricLiu</dc:creator>
    <dc:date>2025-12-22T23:14:28Z</dc:date>
    <item>
      <title>AccessTokenCredential CreateAsync throws exception when accessing resources in federated server</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674605#M13820</link>
      <description>&lt;P&gt;Hi, I'm running into an exception, please help me confirm if this is a bug with ArcGIS or if I used the methods incorrectly. The setup is something like this:&lt;/P&gt;&lt;P&gt;1. User signs into an enterprise portal (let's call Portal A) via OAuth. Our app calls 'AuthenticationManager.Current.RegisterServer' and then 'AuthenticationManager.GenerateCredentialAsync'.&lt;/P&gt;&lt;P&gt;2. User signs-out of the portal. We call 'AuthenticationManager.Current.RemoveAllCredentials' during the sign-out process.&lt;/P&gt;&lt;P&gt;3. User signs into a different ArcGIS portal. This time they go access a token-secured resource belonging to Server A. &lt;STRONG&gt;Server A is federated with Portal A&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Expected Behavior:&lt;/P&gt;&lt;P&gt;We get a challenge for Server A. Server A's 'ServerInfo.TokenAuthenticationType' is 'ArcGISToken', so we prompt the user for the username and password. Then we call 'AccessTokenCredential.CreateAsync(Server A's ServiceUri, username, password)' to get a token for the resource. It should return a valid token.&lt;/P&gt;&lt;P&gt;Actual Behavior:&lt;/P&gt;&lt;P&gt;When calling 'AccessTokenCredential.CreateAsync', it attempts to sign-in to Portal A by calling 'IOauthAuthorizeHandler.AuthourizeAsync'. This shouldn't happen because we've already signed out of Portal A, and it should have no record of Portal A.&lt;/P&gt;&lt;P&gt;If we've never signed into Portal A before accessing the token-secured resource, then everything works fine as described in the expected behavior. If we sign out of Portal A and close the app (&amp;amp; runtime) before calling 'AccessTokenCredential.CreateAsync', it also works fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since 'AccessTokenCredential.CreateAsync' works fine in some cases but not others, it makes me think its a bug with Esri (cached server infos not cleared ?). But maybe federated servers are unique and I'm not handling the challenge correctly.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (1).png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/145990i2B77C7C05E508875/image-size/large?v=v2&amp;amp;px=999" role="button" title="image (1).png" alt="image (1).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2025 22:18:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674605#M13820</guid>
      <dc:creator>EricLiu</dc:creator>
      <dc:date>2025-12-22T22:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: AccessTokenCredential CreateAsync throws exception when accessing resources in federated server</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674607#M13821</link>
      <description>&lt;P&gt;Also, when I'm signed into a portal, and access a token-secured resource from a server that's federated with the portal I'm signed into. It's not automatically re-using my portal credentials for the server. Instead the ChallengeHandler calls CreateCredentialAsync for me to generate a new one.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2025 23:14:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674607#M13821</guid>
      <dc:creator>EricLiu</dc:creator>
      <dc:date>2025-12-22T23:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: AccessTokenCredential CreateAsync throws exception when accessing resources in federated server</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674788#M13823</link>
      <description>&lt;P&gt;I think it some places we are still using the old OAuthTokenCredential. Could it be because I have to call AddCredential on a OAuthUserCredential in order for the credential to be reused for my federated server ?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Dec 2025 21:29:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1674788#M13823</guid>
      <dc:creator>EricLiu</dc:creator>
      <dc:date>2025-12-23T21:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: AccessTokenCredential CreateAsync throws exception when accessing resources in federated server</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1677646#M13848</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/719843"&gt;@EricLiu&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I’m assuming you are using the legacy authentication workflow (relying on &lt;FONT face="courier new,courier"&gt;AuthenticationManager&lt;/FONT&gt; global state), as this behavior stems from cached &lt;FONT face="courier new,courier"&gt;ServerInfo&lt;/FONT&gt;. &lt;FONT face="courier new,courier"&gt;RemoveAllCredentials()&lt;/FONT&gt; clears credentials but not the &lt;FONT face="courier new,courier"&gt;ServerInfo&lt;/FONT&gt; cache. Because this cache persists, the SDK remembers the federation with Portal A even after sign-out.&lt;/P&gt;&lt;P&gt;There isn’t a supported public API to remove those cached &lt;FONT face="courier new,courier"&gt;ServerInfo&lt;/FONT&gt; entries in the legacy authentication system.&lt;/P&gt;&lt;P&gt;​My recommendation would be to migrate to the newer authentication APIs to avoid this class of issues. ​If you must continue using the legacy workflow, restarting the application is currently the only supported way to clear that cache.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2026 20:32:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/accesstokencredential-createasync-throws-exception/m-p/1677646#M13848</guid>
      <dc:creator>pnarkhede</dc:creator>
      <dc:date>2026-01-13T20:32:40Z</dc:date>
    </item>
  </channel>
</rss>

