AnsweredAssumed Answered

Access Private Map without login

Question asked by guilherme.pigosso@hotmail.com on Jul 3, 2018
Latest reply on Jul 4, 2018 by rscheitlin

Hello all,

 

I'm not sure if it's possible, but we would like to access a private map without login. I'm trying to do that using the API token, but is not working very well. My code is something like:

 

require([
    "esri/views/MapView",
    "esri/WebMap",
    "esri/config",
    "esri/identity/IdentityManager",
    "dojo/domReady!"
], function(MapView, WebMap, esriConfig, esriId, domReady){

    esriConfig.portalUrl = "https://test.maps.arcgis.com/"

 

    var userToken = //get token from https://www.arcgis.com/sharing/rest/oauth2/token
    var token = {
        'server': 'https://test.maps.arcgis.com/rest/services',
        'token': userToken
    };
    esriId.registerToken(token);

 

    var webmap = new WebMap({
        portalItem: {
            id: "95e0b154327f45858e963f2974a51a6e"
        }
    });

    var view = new MapView({
        map: webmap,        
        container: "viewDiv"
    });
});

 

But is not working. The map area still blank, like if my map doesn't exists.

 

Any idea?

 

Thank you!

Outcomes