<?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 IdentityManager login does not appear in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identitymanager-login-does-not-appear/m-p/1084477#M74077</link>
    <description>&lt;P&gt;This is the first time I've attempted to use IdentityManager.&amp;nbsp; I have a basic web app built from scratch with the ArcGIS JS API v4.18.&amp;nbsp; I need to display a feature layer that is hosted in ArcGIS Online and shared at the organization level.&amp;nbsp; Because the layer is secured I assumed I would be prompting the user to provide credentials and then get a token.&amp;nbsp; However, I came across &lt;A href="https://developers.arcgis.com/javascript/latest/secure-resources/" target="_self"&gt;this article&lt;/A&gt; about IdentityManager which states:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;To use the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html" target="_blank" rel="noopener"&gt;IdentityManager&lt;/A&gt;&amp;nbsp;simply include&amp;nbsp;esri/identity/IdentityManager&amp;nbsp;as part of your&amp;nbsp;require&amp;nbsp;statement. Once the application runs and requests a resource that is secure, the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html" target="_blank" rel="noopener"&gt;IdentityManager&lt;/A&gt;&amp;nbsp;takes over and handles prompting the user for the appropriate credentials.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That sounds very convenient and simple so I added IdentityManager to the require statement, called the secured feature layer from ArcGIS Online, and added it to my map view's layers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The view and basemap load in the app, but a login never appears and the API seems to be aware that I'm trying to display a secured feature layer because I get the following errors in the console.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="identitymanager_error.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19777i632AF2E1EB00A3D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="identitymanager_error.JPG" alt="identitymanager_error.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The blurb I pasted above from ESRI's JS API documentation implies that calling the feature layer should have triggered IdentityManager to prompt the user for login, but it isn't doing that.&amp;nbsp; No login form appears.&amp;nbsp; What is the expected behavior here?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Is there a better way to prompt the user for login and enable the app to consume the secured feature layer hosted in ArcGIS Online?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Here's the full HTML and JS code for the app.&amp;nbsp; It's just a single page.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CAMS Viewer&amp;lt;/title&amp;gt;
    
    &amp;lt;link rel="stylesheet" href="http://js.arcgis.com/4.18/esri/themes/light/main.css"&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles/style.css"&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles/spin.css"&amp;gt;
    &amp;lt;link rel="shortcut icon" href="favicon.ico"&amp;gt;
    &amp;lt;script src="http://js.arcgis.com/4.18/"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="module"&amp;gt;
        import {config} from './scripts/config.js';

        const legendDiv = document.getElementById("legend-panel-body");

        require([
            "esri/config",
            "esri/Map",
            "esri/identity/IdentityManager",
            "esri/views/MapView",
            "esri/widgets/BasemapGallery",
            "esri/layers/FeatureLayer",
            "esri/geometry/SpatialReference",
            "esri/tasks/support/Query",
            "esri/widgets/Search"
            
        ], function async(esriConfig, Map, esriId, MapView, BasemapGallery, FeatureLayer, SpatialReference, Query, Search) {

            esriConfig.apiKey = config.arcgisApiKey;

            const censusBlocksLayer = new FeatureLayer(config.censusBlocksUrl);

            const map = new Map({
                basemap: "arcgis-topographic", // Basemap layer service
                layers: [censusBlocksLayer]
            });

            const view = new MapView({
                map: map,
                center: [-82.338, 27.927], // Longitude, latitude
                zoom: 11, // Zoom level
                container: "viewDiv", // Div element
            });

            // basemap gallery widget
            const basemapGallery = new BasemapGallery({
                view: view
            });

            view.ui.add(basemapGallery, {
                position: "top-right"
            });

            // Search widget
            var searchWidget = new Search({
                view: view,
                container: document.querySelector('#search-widget-wrapper')
            });
        });
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div id="header"&amp;gt;
        &amp;lt;div id="logo-container"&amp;gt;
            &amp;lt;img src="img/hc_logo_graybg.png"/&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div id="header-title"&amp;gt;
            DEV
        &amp;lt;/div&amp;gt;
        &amp;lt;div id="search-widget-wrapper"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div id="header-widget-menu"&amp;gt;
            &amp;lt;img src="img/basemap-24.png" class="widget-btn" data-toggle-selector=".esri-basemap-gallery"/&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div id="main-container"&amp;gt;
        &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jul 2021 16:29:14 GMT</pubDate>
    <dc:creator>GeoSolver</dc:creator>
    <dc:date>2021-07-30T16:29:14Z</dc:date>
    <item>
      <title>IdentityManager login does not appear</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identitymanager-login-does-not-appear/m-p/1084477#M74077</link>
      <description>&lt;P&gt;This is the first time I've attempted to use IdentityManager.&amp;nbsp; I have a basic web app built from scratch with the ArcGIS JS API v4.18.&amp;nbsp; I need to display a feature layer that is hosted in ArcGIS Online and shared at the organization level.&amp;nbsp; Because the layer is secured I assumed I would be prompting the user to provide credentials and then get a token.&amp;nbsp; However, I came across &lt;A href="https://developers.arcgis.com/javascript/latest/secure-resources/" target="_self"&gt;this article&lt;/A&gt; about IdentityManager which states:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;To use the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html" target="_blank" rel="noopener"&gt;IdentityManager&lt;/A&gt;&amp;nbsp;simply include&amp;nbsp;esri/identity/IdentityManager&amp;nbsp;as part of your&amp;nbsp;require&amp;nbsp;statement. Once the application runs and requests a resource that is secure, the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html" target="_blank" rel="noopener"&gt;IdentityManager&lt;/A&gt;&amp;nbsp;takes over and handles prompting the user for the appropriate credentials.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That sounds very convenient and simple so I added IdentityManager to the require statement, called the secured feature layer from ArcGIS Online, and added it to my map view's layers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The view and basemap load in the app, but a login never appears and the API seems to be aware that I'm trying to display a secured feature layer because I get the following errors in the console.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="identitymanager_error.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19777i632AF2E1EB00A3D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="identitymanager_error.JPG" alt="identitymanager_error.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The blurb I pasted above from ESRI's JS API documentation implies that calling the feature layer should have triggered IdentityManager to prompt the user for login, but it isn't doing that.&amp;nbsp; No login form appears.&amp;nbsp; What is the expected behavior here?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Is there a better way to prompt the user for login and enable the app to consume the secured feature layer hosted in ArcGIS Online?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Here's the full HTML and JS code for the app.&amp;nbsp; It's just a single page.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CAMS Viewer&amp;lt;/title&amp;gt;
    
    &amp;lt;link rel="stylesheet" href="http://js.arcgis.com/4.18/esri/themes/light/main.css"&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles/style.css"&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles/spin.css"&amp;gt;
    &amp;lt;link rel="shortcut icon" href="favicon.ico"&amp;gt;
    &amp;lt;script src="http://js.arcgis.com/4.18/"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="module"&amp;gt;
        import {config} from './scripts/config.js';

        const legendDiv = document.getElementById("legend-panel-body");

        require([
            "esri/config",
            "esri/Map",
            "esri/identity/IdentityManager",
            "esri/views/MapView",
            "esri/widgets/BasemapGallery",
            "esri/layers/FeatureLayer",
            "esri/geometry/SpatialReference",
            "esri/tasks/support/Query",
            "esri/widgets/Search"
            
        ], function async(esriConfig, Map, esriId, MapView, BasemapGallery, FeatureLayer, SpatialReference, Query, Search) {

            esriConfig.apiKey = config.arcgisApiKey;

            const censusBlocksLayer = new FeatureLayer(config.censusBlocksUrl);

            const map = new Map({
                basemap: "arcgis-topographic", // Basemap layer service
                layers: [censusBlocksLayer]
            });

            const view = new MapView({
                map: map,
                center: [-82.338, 27.927], // Longitude, latitude
                zoom: 11, // Zoom level
                container: "viewDiv", // Div element
            });

            // basemap gallery widget
            const basemapGallery = new BasemapGallery({
                view: view
            });

            view.ui.add(basemapGallery, {
                position: "top-right"
            });

            // Search widget
            var searchWidget = new Search({
                view: view,
                container: document.querySelector('#search-widget-wrapper')
            });
        });
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div id="header"&amp;gt;
        &amp;lt;div id="logo-container"&amp;gt;
            &amp;lt;img src="img/hc_logo_graybg.png"/&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div id="header-title"&amp;gt;
            DEV
        &amp;lt;/div&amp;gt;
        &amp;lt;div id="search-widget-wrapper"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div id="header-widget-menu"&amp;gt;
            &amp;lt;img src="img/basemap-24.png" class="widget-btn" data-toggle-selector=".esri-basemap-gallery"/&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div id="main-container"&amp;gt;
        &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 16:29:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identitymanager-login-does-not-appear/m-p/1084477#M74077</guid>
      <dc:creator>GeoSolver</dc:creator>
      <dc:date>2021-07-30T16:29:14Z</dc:date>
    </item>
  </channel>
</rss>

