AnsweredAssumed Answered

Programmatically Log In to ArcGIS Online via Javascript Application

Question asked by beck3905 on Jan 7, 2014
Latest reply on Dec 8, 2017 by carlosnantes
I have a Javascript Web Map Application using the Esri JS API that is accessing data in ArcGIS Online.  I don't want my users to have to log in to ArcGIS Online in order to access the content so I'd like the app to log in instead.

So far I was able to accomplish this using a proxy page that attaches a token to any requests for secured services.  This method works, but the proxy page creates a bottleneck and the performance decrease is very noticeable when using the app even when panning and zooming.

I've been looking at the documentation for the IdentityManager, IdentityManagerBase, and Credential classes in the JS API to see if there is a way to recreate the process used when the user is prompted for credentials by adding credentials to the Identity Manager programmatically.  So far I cannot figure out how to save a token in the IdentityManager for use by future requests.

Is there a way that I could use my proxy page to retrieve a token when the app is loaded and then add the token to the IdentityManager so it would automatically be added to any necessary requests and the user would not be prompted for credentials?

Outcomes