My company is new to ArcGIS Online (AGOL). We tested using JavaScript API to access or embed an AGOL map shared only within our organization, and found it did not work unless we change the map to share to Public. This does not work for us as we won't want people outside our organization to discover/access the map. Is there a workaround this?
Could you do something like this:
OAuth Basic | ArcGIS API for JavaScript 3.17
Then share the map only with the organization?
Then the users would have to log in to see the map.
Hi Allen,
You will need to include the IdentityManager module in your code.
This module returns a singleton class that is automatically instantiated into esri.id
when the module containing this class is imported into the application. This module provides the framework and helper methods required to implement a solution for managing user credentials for the following resources:
Jake and Rickey, thanks for the hint. Our AGOL is integrated with AD through OKTA (SAML). Not sure if the sample code will work, but will give it a try. Here is the simple testing code that tries to access a map shared to our organization.
...
<script>
require([
"esri/views/MapView",
"esri/WebMap",
"esri/config",
"dojo/domReady!"
], function(MapView, WebMap, esriConfig, domReady){
esriConfig.portalUrl = "https://npu-portal.maps.arcgis.com"
var webmap = new WebMap({
portalItem: {
id: "0d5f519dea1642429d3b358327f7e920"
}
});
var view = new MapView({
map: webmap,
container: "viewDiv"
});
});
</script>
...