AnsweredAssumed Answered

Issues with Legend widget accessing secure layer

Question asked by marcus.bush on Jan 3, 2014
Latest reply on Jan 9, 2014 by marcus.bush

I am working on an app, using version 3.5 of the jsapi, that has a few layers including one service layer that is secure and requires a name and password to access.

I have no problem adding this layer to the map itself using code to add a token at the end of the service url, but the same method isn't working for adding it to the legend widget.

I have tried to change up the order of things,

  • Tried to call the widget in the "onLoad" event

  • Tried to call it in a button click event, to make sure the map had its other layers loaded first

Attempting to add the secure layer to the widget results in getting challenged for the name and password not once, but for every index in the service. before it tries to create the legend.

I've tried adding the legend without the token, and adding it to the LayerInfo array AFTER the tokened version has been added to the map, it doesn't seem to matter, I get no legend for it.

Does anyone have any advice for this?