How to seamlessly access an ArcGIS Online map no-shared to public?

1308
3
09-06-2016 10:38 AM
AllenGuan1
New Contributor II

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?

Tags (2)
0 Kudos
3 Replies
RickeyFight
MVP Regular Contributor

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. 

0 Kudos
JakeSkinner
Esri Esteemed Contributor

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:

  • ArcGIS Server resources secured using token-based authentication. Note that only ArcGIS Server versions 10 SP 1 and greater are supported.
  • Secured ArcGIS.com resources (i.e. web maps).
AllenGuan1
New Contributor II

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>

...

0 Kudos