Is there a way to capture the User Name when the user is prompted to add their credentials for a secured service? I want to write the user name to a variable in Javascript
Jay,
The help docs are your friend:
IdentityManager | API Reference | ArcGIS API for JavaScript 3.20
IdentityManager.credentials[0].userId
From this OAuth sample: OAuth Basic | ArcGIS API for JavaScript 3.20
The variable "portalUser" contains the "userName" property. You can examine all the properties by opening up the developer tools in your browser and put a breakpoint at line 118.
Bit confused here and want to make sure we are on the same page.
I have a simple Javascript app that I wrote. Nothing is pointing to to ArcGIS online, but rather one of my own Map Services which prompts the user for credentials. When they enter those and the app opens I want to write UserName to a variable.
Jay,
That is what the line of code and like I provided are for.