<?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 IdentifyManager - Sign In dialog at client side in WAB application ? in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/identifymanager-sign-in-dialog-at-client-side-in/m-p/717682#M18908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I created app using WAB 2.8 developer edition, downloaded and hosted on my web server. It working fine.&lt;/P&gt;&lt;P&gt;I want to use this code&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jssamples/widget_identitymanager_client_side.html" title="https://developers.arcgis.com/javascript/3/jssamples/widget_identitymanager_client_side.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Identity Manager with info persisted client side | ArcGIS API for JavaScript 3.25&lt;/A&gt;&amp;nbsp; in app, store token at client side, and show Sign In dialog&amp;nbsp;automatically after 1 hour token expires.&lt;/P&gt;&lt;P&gt;I do not want to use proxy as my requirement is to have token based authentication - display Sign In dialog when you open the app and Sign In dialog automatically get prompted when token expires ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where should I add below code in WAB app ?&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; map&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; cred &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"esri_jsapi_id_manager_data"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// cookie/local storage name&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; require&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;([&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/_base/unload"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/cookie"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/json"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/parser"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"esri/config"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"esri/IdentityManager"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/domReady!"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;],&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;baseUnload&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; JSON&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; parser&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; esriConfig&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// store credentials/serverInfos before the page unloads&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; baseUnload&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;addOnUnload&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;storeCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// look for credentials in local storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; loadCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;();&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; parser&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;parse&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;();&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; esriConfig&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;defaults&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;io&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;proxyUrl &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"/proxy/"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; loadCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idObject&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;supports_local_storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;())&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// read from local storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; window&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;localStorage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;getItem&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;else&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// read from a cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;!=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"null"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;length &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #009999;"&gt;4&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idObject &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; JSON&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;parse&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;idJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;initialize&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;idObject&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;else&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// console.log("didn't find anything to load :(");&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; storeCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// make sure there are some credentials to persist&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;credentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;length &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;===&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #009999;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// serialize the ID manager state to a string&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idString &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; JSON&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;stringify&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;toJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;());&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// store it client side&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;supports_local_storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;())&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// use local storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;localStorage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;setItem&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idString&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// console.log("wrote to local storage");&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;else&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// use a cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idString&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;expires&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #009999;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;});&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// console.log("wrote a cookie :-/");&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; supports_local_storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;try&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"localStorage"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; in window &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; window&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"localStorage"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;!==&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;null&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;catch&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;e&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;false&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;});&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 06:43:51 GMT</pubDate>
    <dc:creator>MayurDodiya</dc:creator>
    <dc:date>2021-12-12T06:43:51Z</dc:date>
    <item>
      <title>IdentifyManager - Sign In dialog at client side in WAB application ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/identifymanager-sign-in-dialog-at-client-side-in/m-p/717682#M18908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I created app using WAB 2.8 developer edition, downloaded and hosted on my web server. It working fine.&lt;/P&gt;&lt;P&gt;I want to use this code&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jssamples/widget_identitymanager_client_side.html" title="https://developers.arcgis.com/javascript/3/jssamples/widget_identitymanager_client_side.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Identity Manager with info persisted client side | ArcGIS API for JavaScript 3.25&lt;/A&gt;&amp;nbsp; in app, store token at client side, and show Sign In dialog&amp;nbsp;automatically after 1 hour token expires.&lt;/P&gt;&lt;P&gt;I do not want to use proxy as my requirement is to have token based authentication - display Sign In dialog when you open the app and Sign In dialog automatically get prompted when token expires ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where should I add below code in WAB app ?&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; map&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; cred &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"esri_jsapi_id_manager_data"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// cookie/local storage name&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; require&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;([&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/_base/unload"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/cookie"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/json"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/parser"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"esri/config"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"esri/IdentityManager"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"dojo/domReady!"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;],&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;baseUnload&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; JSON&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; parser&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; esriConfig&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// store credentials/serverInfos before the page unloads&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; baseUnload&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;addOnUnload&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;storeCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// look for credentials in local storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; loadCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;();&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; parser&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;parse&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;();&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; esriConfig&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;defaults&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;io&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;proxyUrl &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"/proxy/"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; loadCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idObject&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;supports_local_storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;())&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// read from local storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; window&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;localStorage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;getItem&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;else&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// read from a cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idJson &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;!=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"null"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;length &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #009999;"&gt;4&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idObject &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; JSON&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;parse&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;idJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;initialize&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;idObject&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;else&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// console.log("didn't find anything to load :(");&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; storeCredentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// make sure there are some credentials to persist&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;credentials&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;length &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;===&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #009999;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// serialize the ID manager state to a string&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idString &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; JSON&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;stringify&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;esriId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;toJson&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;());&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// store it client side&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;supports_local_storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;())&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// use local storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;localStorage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;setItem&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idString&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// console.log("wrote to local storage");&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;else&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// use a cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cookie&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;cred&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; idString&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;expires&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #009999;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;});&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #999988;"&gt;// console.log("wrote a cookie :-/");&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;

&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; supports_local_storage&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(){&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;try&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"localStorage"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; in window &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; window&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #dd1144;"&gt;"localStorage"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;!==&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;null&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;catch&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;e&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #333333; font-weight: bold;"&gt;false&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;
&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;});&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:43:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/identifymanager-sign-in-dialog-at-client-side-in/m-p/717682#M18908</guid>
      <dc:creator>MayurDodiya</dc:creator>
      <dc:date>2021-12-12T06:43:51Z</dc:date>
    </item>
  </channel>
</rss>

