<?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: calling destroyCredentials on identityManager does not invalidate oauth token in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1282202#M80950</link>
    <description>&lt;P&gt;Thank you for your reply. Unfortunately you solution did not do the trick for me.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2023 06:45:32 GMT</pubDate>
    <dc:creator>omar-marji</dc:creator>
    <dc:date>2023-04-25T06:45:32Z</dc:date>
    <item>
      <title>calling destroyCredentials on identityManager does not invalidate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1277220#M80823</link>
      <description>&lt;P&gt;In our app, we are using the oauth2 flow to authenticate users using the identity manager's&amp;nbsp;&lt;FONT face="lucida sans unicode,lucida sans"&gt;registerOAuthInfos()&lt;/FONT&gt; and &lt;FONT face="lucida sans unicode,lucida sans"&gt;getCredential()&lt;/FONT&gt; methods.&lt;/P&gt;&lt;P&gt;Once the user signs out, we are calling the&amp;nbsp;&lt;FONT face="lucida sans unicode,lucida sans"&gt;destroyCredentials()&lt;/FONT&gt; method.&lt;/P&gt;&lt;P&gt;But if we use the existing token after &lt;FONT face="lucida sans unicode,lucida sans"&gt;destroyCredentials()&lt;/FONT&gt; is called to call any rest endpoint, it appears that the token is still valid and was not revoked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We also tried to use the REST JS API to create an identity manager using&amp;nbsp;&lt;FONT face="lucida sans unicode,lucida sans"&gt;ArcGISIdentityManager.fromCredential()&lt;/FONT&gt; method (supplying the information from the Maps SDK for JS identity manager) then calling the &lt;FONT face="lucida sans unicode,lucida sans"&gt;signout()&lt;/FONT&gt; method on it. But still it results in the same behavior.&lt;/P&gt;&lt;P&gt;We even tried to manually call the &lt;FONT face="lucida sans unicode,lucida sans"&gt;/revokeToken&lt;/FONT&gt; (&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/revoke-token.htm" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/revoke-token.htm&lt;/A&gt;) rest end point, which also does nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to revoke the user's tokens after logout?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 10:32:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1277220#M80823</guid>
      <dc:creator>omar-marji</dc:creator>
      <dc:date>2023-04-11T10:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: calling destroyCredentials on identityManager does not invalidate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1279181#M80896</link>
      <description>&lt;P&gt;This was in the context of a WAB widget but I too had problems with signing out, and ended up doing this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;      var oReq = new XMLHttpRequest();
      oReq.open("get", `${IdentityManager.oAuthInfos[0].portalUrl}/sharing/rest/oauth2/signout`, false);
      oReq.setRequestHeader('Content-Type', 'text/xml');
      oReq.send();&lt;/LI-CODE&gt;&lt;P&gt;which should take care of the server side.&lt;/P&gt;&lt;P&gt;And then all this to get the client to destroy all the things&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  function logOut() {
    if (window.appInfo.isRunInPortal) {
      removeEsriAuthCookieStorage();
    }
    else {
      removeCookie(context, "wab_auth");
    }

    IdentityManager.destroyCredentials();    
  };

  const removeEsriAuthCookieStorage = (context) =&amp;gt; {
    removeCookie(context, 'esri_auth');
  
    var itemName = "esriJSAPIOAuth";
    if (window.localStorage) {
      window.localStorage.removeItem(itemName);
    }
    if (window.sessionStorage) {
      window.sessionStorage.removeItem(itemName);
    }
  }

  const removeCookie = (cookieName) =&amp;gt; {
    var path = '/';
    jimuUtils.removeCookie(cookieName, path);
  };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 09:51:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1279181#M80896</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2023-04-17T09:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: calling destroyCredentials on identityManager does not invalidate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1282202#M80950</link>
      <description>&lt;P&gt;Thank you for your reply. Unfortunately you solution did not do the trick for me.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 06:45:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-destroycredentials-on-identitymanager-does/m-p/1282202#M80950</guid>
      <dc:creator>omar-marji</dc:creator>
      <dc:date>2023-04-25T06:45:32Z</dc:date>
    </item>
  </channel>
</rss>

