I'm using the ArcGIS JavaScript API 3.7 for web map service. The web map is based on Oauth2 authentication. I use java code to fetch the token. Then I need to fetch the map in javascript by calling esri.arcgis.utils.createMap(). But How to pass the token with this request?

I know ArcGIS JavaScript 3.7 offers an API called esri.IdentityManager.registerToken() that can pass the token will the request. But this method requires the user name as parameter. I don't want to put the username in the javascript code, as it's not safe.

Are there any other ways to pass the token with the request?

The api for esri.IdentityManager.registerToken() is here.

  • did you ever get this to work? Even using the username? (I don't mind using username as only exposed when user themselves is logged on via server-side process) – Gavin Dec 13 '17 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.