ESRI web map: How to pass the OAuth token to fetch the web map without passing userid

Discussion created by rmai on Dec 26, 2013
Latest reply on Dec 30, 2013 by kramer_usc
I'm using ESRI 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 ESRI3.7 offers a 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: https://developers.arcgis.com/en/jav...#registertoken Thanks a lot.
:confused: Is it a must to send the username with token to query authenticated web map? Is there a way to get the result only with the token?