I am not able to do background login and get item from ArcGIS online somehow.What I am doing is, I manually generateToken using IdentityManagerBase and then manipulate cookie information with tokeninfo.Then I use esri.id.initialize with cookie to re-hydrate the state of identity manager. But login window would still pop up to ask for credential.However If I simply use popup window to login first time and let IdentityManager to handle cookie, it does work. I don't get pop up anymore.Here is the IdentityManager generated cookie{"serverInfos":[{"server":"http://www.arcgis.com","tokenServiceUrl":"https://www.arcgis.com/sharing/generateToken"}],"credentials":[{"userId":"MYUSERID","server":"http://www.arcgis.com","token":"1Ukoeka9lU2yjIYVlZls1ryjziqwr9VXr8du1WL6UQUfZHiIZ3JxhSZIaVx4-p3Ce4dZh_mnwMUKTerzgtvohC6TfAZr-F7kmAp6Gc6T8I5GrFIQVmIFF-B9NGDbSHv3zYkFB1IZ7H-Ffw3fZlRQaQ..","expires":1366830106409,"ssl":false,"creationTime":1366826506409,"resources":["MYRESOURCE"]}]}Here is the cookie I manipulated{"serverInfos":[{"server":"http://www.arcgis.com","tokenServiceUrl":"https://www.arcgis.com/sharing/generateToken"}],"credentials":[{"userId":"MYUSERID","server":"http://www.arcgis.com","token":"VE0L7bzjaGGWij17aa15Gwqnv7NFfoHOHYeSL97gfqeoK1NI7hK4DTW7KE4V1Ec3Cyq2tOjnKfCHwAAdQKCA3dnmshqS0mOeQHocH0zdcAzZQSVb3BUeWuFbyYGN4awrVQ8U1bk52KrkYcNngo-36Q..","expires":1366830235531,"ssl":false,"creationTime":1366826635531,"resources":["MYRESOURCE"]}]}I compared both cookies, and it seems that only difference is token.Here is the code for generateToken. Am I missing something?var idBase = new esri.IdentityManagerBase();
var serverInfo = {
"server": "http://www.arcgis.com",
"tokenServiceUrl": "https://www.arcgis.com/sharing/generateToken"
};
var def = idBase.generateToken(serverInfo, { "username": "MYUSERNAME*", "password": "MYPASSWORD", "client": "referer", "referer": "http://MYIP:MYPORT/index.html" });
BTW, I am running app in localhost right now.Any thought would be appreciated!Tony