AnsweredAssumed Answered

IdentityManager - no login screen displayed?

Question asked by schlot on Dec 12, 2012
Latest reply on Jan 28, 2016 by rburke-esristaff
I am working through a basic IdentifyManager example.  I have modified the bare minimum, just enough to have my extent and my services.  When I run/debug this, it doesn't display a login. Is that because it doesn't really think my service is secure?  The older examples show the login in a contentpane, but I assume identitymanager is what is controlling the login that comes up?  How does it know what to put as the prompt?  Just from the name of the service you are trying to load?

I am using ArcGIS Server 10.1 SP5 and the security has been enabled and configured.  and the security has been enabled.  I have assigned a userID password to my service.  I can generate a token from the service directory, so I think the server is set up to generate a token.  I believe my proxy pages are configured and working.  I have my SSL in place on my server.  These are all things that I've seen that must be in place for this to work.

It doesn't have to be a featureservice does it?  I haven't seen that that is a requirement so far.  I am using a featureLayer instead. 
<!DOCTYPE html>  <html>  <head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <meta http-equiv="X-UA-Compatible" content="IE=7" />    <title>Persisting Identity Manager Info</title>    <link rel="stylesheet" href="//">    <link rel="stylesheet" href="//" />    <style type="text/css">        html, body {          height: 98%; width: 99%;          margin:0;          padding-top:4px;          padding-left:4px;        }          #rightPanel{          width:140px;          border:2px solid #617798;          -webkit-border-top-right-radius: 4px;          -webkit-border-bottom-right-radius: 4px;          -moz-border-radius-topright: 4px;          -moz-border-radius-bottomright: 4px;          border-top-right-radius: 4px;          border-bottom-right-radius: 4px;        }          #mapCanvas{          border-top:2px solid #617798;          border-bottom:2px solid #617798;          border-left:2px solid #617798;          -webkit-border-top-left-radius: 4px;          -webkit-border-bottom-left-radius: 4px;          -moz-border-radius-topleft: 4px;          -moz-border-radius-bottomleft: 4px;          border-top-left-radius: 4px;          border-bottom-left-radius: 4px;          padding:0px;        }          .templatePicker{          height:80%;        }    </style>      <script>var dojoConfig = { parseOnLoad: true };</script>    <script src="//"></script>      <script type="text/javascript">      dojo.require("dijit.layout.BorderContainer");      dojo.require("dijit.layout.ContentPane");      dojo.require("");      dojo.require("esri.layers.FeatureLayer");      dojo.require("esri.IdentityManager");        var map, cred = "esri_jsapi_id_manager_data"; // cookie/local storage name        function init() {        // store credentials/serverInfos before the page unloads        dojo.addOnUnload(storeCredentials);        // look for credentials in local storage        loadCredentials(); = "";    /*       map = new esri.Map("mapCanvas",{          extent: new esri.geometry.Extent({"xmin":-12080521,"ymin":4472736,"xmax":-11829657,"ymax":4563023,"spatialReference":{"wkid":3857}})        });  */  var spatialReference = new esri.SpatialReference({             wkid: 102100         });         startExtent = new esri.geometry.Extent(-10723197, 4186914, -9829190, 4992866, spatialReference);         map = new esri.Map("mapCanvas", {             extent: startExtent         });       dojo.connect(map, "onLoad", function() {          dojo.connect(dijit.byId('mapCanvas'), 'resize', map,map.resize);        });          var basemap = new esri.layers.ArcGISTiledMapServiceLayer("");        map.addLayer(basemap);        var countyLayer = new esri.layers.ArcGISDynamicMapServiceLayer("");        map.addLayer(countyLayer);        var serverLayer = new esri.layers.FeatureLayer("",{          mode:esri.layers.FeatureLayer.MODE_ONDEMAND,          outFields:["*"]        });        map.addLayer(serverLayer);      }        function loadCredentials() {        var idJson, idObject;          if ( supports_local_storage() ) {          // read from local storage          idJson = window.localStorage.getItem(cred);        } else {          // read from a cookie          idJson = dojo.cookie(cred);        }          if ( idJson && idJson != "null" && idJson.length > 4) {          idObject = dojo.fromJson(idJson);;        } else {           console.log("didn't find anything to load :(");        }      }        function storeCredentials() {        // make sure there are some credentials to persist        if ( === 0 ) {          return;        }          // serialize the ID manager state to a string        var idString = dojo.toJson(;        // store it client side        if ( supports_local_storage() ) {          // use local storage          window.localStorage.setItem(cred, idString);          // console.log("wrote to local storage");        } else {          // use a cookie          dojo.cookie(cred, idString, { expires: 1 });          // console.log("wrote a cookie :-/");        }      }        function supports_local_storage() {        try {          return "localStorage" in window && window["localStorage"] !== null;        } catch( e ) {          return false;        }      }      dojo.ready(init);    </script>  </head>    <body class="tundra">    <div data-dojo-type="dijit.layout.BorderContainer"         data-dojo-props="design:'headline',gutters:false"         style="position:relative;width:100%;height:100%;">     <div id="mapCanvas"          data-dojo-type="dijit.layout.ContentPane"          data-dojo-props="region:'center'">       </div>     <!--right content panel-->     <div id="rightPanel"          data-dojo-type="dijit.layout.ContentPane"          data-dojo-props="region:'right'">       <p>        This sample shows how to view a secure map service using token-based authentication. Use the following credentials        to test the application:</br> User Name: <b>rick</b></br>Password: <b>rick@esri</b>       </p>        <div id="content" style="height:100%;"></div>     </div>    </div>    </body>  </html>