//access the user credential stored in the idObject var user = idObject.credentials[0].userId; var demoMapService = new ArcGISDynamicMapServiceLayer("https://****"); //ser layer Definition based on the user name var layerDefs = []; layerDefs[1] = "owner='"+ user+"'"; demoMapService.setLayerDefinitions(layerDefs); map.addLayer(demoMapService);
TypeError: idObject is undefined http://atreyu/AuthenticationTemplate/index.html Line 79
Solved! Go to Solution.
Hi,
This error means that the variable "idObject" is undefined.
Just add in the beginning of your script:
var idObject;
Hi,
Assuming you're referring to this sample: https://developers.arcgis.com/en/javascript/jssamples/widget_identitymanager_client_side.html you might uncomment and tweak the console log message in the loadCredentials function to see if the problem is in the presence of or parsing of the idJson. Might could be something is up with the cookie (disabled or security setting?). And if there's another template or something you're referring to, maybe using this simple javascript sample would help you reduce variables and narrow down the issue.
Good luck!
ken.