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,
That is what the line of code and like I provided are for.
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.
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.
The help docs are your friend:
IdentityManager | API Reference | ArcGIS API for JavaScript 3.20
IdentityManager.credentials[0].userId
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.