In a widget we need to be able to grab the UserID of the user currently logged in to the app (e.g. assuming they have signed in via AGOL or Portal), and then pass this userID as a string input parameter to another web service. Is this possible? Any ideas on how we can access current userID?
We have previously been using Geocortex Essentials and Workflow Designer, and there was a "GetCurrentUser" activity that made this very easy to do, and I was hoping there might be something like this that can be used in a Widget?
I saw that the Javascript API has a method called "Credential"
Credential | API Reference | ArcGIS API for JavaScript that includes UserID, but I am not sure I understand where we would call this or, or if we can even access the credentials from within a Widget once the user has already authenticated?
Thanks for any feedback/ideas.
For reference, I have already looked at following threads relating to securing applications to try to better understand how authentication works for Web Apps made with WAB Dev Edition (though am still digesting the material to make sense...):
Authentication through ArcGIS Online for customized Web Apps
Second login prompts while authenticating arcgis online with oAuth