Detect or prevent the ArcGIS authentication dialog if sent to map

61
1
Jump to solution
3 weeks ago
GregoryBologna
Occasional Contributor

I consume ImageServer tiles from a partner's ArcGIS. Sometimes their ArcGIS server goes down or the permissions change after they republish, and it may be an hour or so before they resolve this. The problem is that the public will see the ArcGIS authentication dialog anytime the map is accessed (see screenshot). 

 

Here I create the ImageryTileLayer tlay.

var layerUrl = someArcGISUrl + "/" + year + "/AERIAL_" + year + (year > 2002 ? "_RGB" : "_BW") + "/ImageServer";
var tlay = new ImageryTileLayer({
url: layerUrl,
title: year
});

I don't want the authentication dialog to display. I have not found a way to detect or prevent it. It would be great to have a property that disables showing such dialogs.

Here I check for any errors, but "layerview-create-error" will be hit after the authentication dialog is cancelled.

tlay.when("layerview-create-error", function(event) {
console.info(event);
});

 

promptprompt

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor

It's a pretty unique request, and we don't doc this, don't really support it, so it could change at any point in the future without notice. This will also break any other legitimate OAuth you might have in your app, when tokens expire or other similar issues. Pretty much voids your warranty. You didn't get this from me.

 

 

IdentityManager.on("dialog-create", () => {
  IdentityManager.dialog.open = false;
});

 

https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#eve...

https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#dia...

View solution in original post

1 Reply
ReneRubalcava
Frequent Contributor

It's a pretty unique request, and we don't doc this, don't really support it, so it could change at any point in the future without notice. This will also break any other legitimate OAuth you might have in your app, when tokens expire or other similar issues. Pretty much voids your warranty. You didn't get this from me.

 

 

IdentityManager.on("dialog-create", () => {
  IdentityManager.dialog.open = false;
});

 

https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#eve...

https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#dia...

View solution in original post