Select to view content in your preferred language

No changes made, now code does not work

771
4
Jump to solution
09-04-2013 04:20 PM
DanielSmith
Frequent Contributor
I was playing around tinkering with how to subset data based on user ID. I used the Persisting Identity Manager template from ESRI as a starting point. i ended up using the idObject to gain access to the userID and used that in value in a definition query of the operational layers.

 //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);


this was working fine until i came back to it today and i am no longer prompted for credentials.
Firebug says:
 TypeError: idObject is undefined http://atreyu/AuthenticationTemplate/index.html Line 79


oddly my button_click() is also coming up as undefined though all the code is there. '

Any hints or clues?
0 Kudos
1 Solution

Accepted Solutions
KenBurcham
Deactivated User
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.

View solution in original post

0 Kudos
4 Replies
JoseSanchez
Frequent Contributor
Hi,

This error means that the variable  "idObject" is undefined.

Just add in the beginning of your script:

var  idObject;
0 Kudos
KenBurcham
Deactivated User
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.
0 Kudos
DanielSmith
Frequent Contributor
Hi,

This error means that the variable  "idObject" is undefined.

Just add in the beginning of your script:

var  idObject;


it came down to the credentials being stored and me referencing them by index value. so it was not able to find the index value of idObject. I tried removing all cookies and such but the old credentials persisted... it does work but still need to deal with the stored creds
0 Kudos
DanielSmith
Frequent Contributor
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.


Ken,

you are correct that it had to do with persistence of the previous credentials. Got pulled off this for a bit but am getting back into it next week. thnx for your thoughts.
0 Kudos