I am working on an application that can store multiple web map configurations and load them up in the map view. Web maps can be from ArcGIS Online or different instances of Portal for ArcGIS. These are secured and I am generating a token to access them. When loading up each web map, I am doing the following... esriConfig.portalUrl = portalUrl; identityManager.registerToken(token); const webmap = new WebMap({ portalItem: { id: webMapId } }); mapView.map = webmap; This works on the first web map to be loaded. If I swap to another web map configuration and follow the same steps, the map doesn't load and I get the following error: dojo.js:310 [esri.WebMap] #load() Failed to load web map message: "Failed to load portal item" If I drill into the message details I see "Item does not exist or is inaccessible". I see the URL for the item is appending the new web map ID to the items API endpoint URL of the first web map that was loaded. If I try to load additional web maps they all fail, unless they have the same portal URL as the first web map loaded. If I refresh and load a failed web map first, it loads fine and the other maps fail... so it's not an access/token issue for a specific web map. If I debug, I can see IdentityManager has a "_portals" collection of URLs which builds up with each new portal I attempt to access. It looks like the first _portals URL (_portals[0]) may be getting used each time even though the portal URL is getting updated on the esriConfig. (Edit: I've tried clearing out the _portals and serverInfos collections in IdentityManager but the old URL is still being used to form the items endpoint... can't see where this is being persisted) Is this a bug? Any suggestions? Is there any way to reset the Identity Manager? It's different to the other modules as "instead of returning a class constructor, it returns a singleton instance that has already been created by this module".
... View more