Select to view content in your preferred language

get user name from identity manager

3605
2
Jump to solution
08-12-2013 09:39 AM
ZorbaConlen
Deactivated User
Hi,
Wondering how one would go about getting the user name entered by an end user, from the identity manager? I have secured services in my app, and users are prompted for authentication by identity manager. I'd like to capture the user name and use this info to modify the interface. For my app, there are only a couple of generic users so its pretty simple. Anyone have an example? Thanks.
0 Kudos
1 Solution

Accepted Solutions
MattLane
Frequent Contributor
esri.id.credentials holds all the credentials for the page and is populated after the login. credential.userId is what you are looking for. Each layer also has a credential object, in case you need credential information for a specific layer.

One way to get the info is:
dojo.connect(TNMap.map, "onLayerAddResult", function (result, error) {   if (result.credential && result.credential.userId){   console.log(result.credential);   }; });

View solution in original post

0 Kudos
2 Replies
MattLane
Frequent Contributor
esri.id.credentials holds all the credentials for the page and is populated after the login. credential.userId is what you are looking for. Each layer also has a credential object, in case you need credential information for a specific layer.

One way to get the info is:
dojo.connect(TNMap.map, "onLayerAddResult", function (result, error) {   if (result.credential && result.credential.userId){   console.log(result.credential);   }; });
0 Kudos
ZorbaConlen
Deactivated User
Matt,
Thanks for the reply. That's just what I needed. I can get the username with:

esri.id.credentials[0].userId


Thanks
0 Kudos