Get current user info in Web App builder

2442
1
05-17-2017 02:02 AM
SantiagoMontoya
New Contributor

Hi everyone.

I have a web mapping application and a group map shared with some user registered, the user enters by login. What I want to accomplish is to get the information of the current user in the application, like username, group id, etc...

I have tried without success using the object portal and its functions like:

            var portal = new arcgisPortal.Portal('my url');
            var user = portal.getPortalUser();
            console.log(user);
            console.log("user id: " + user.username);

But I think that what I need is to access to the portal object of the application, and this code is creating a new portal instead. I have seen that using the property credential, you can access to this info as well. Any ideas?

Thanks in advance.

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Esteemed Contributor