I'm using the Javacript API IdentityManager WITHOUT OAuth to sign in to a portal. This works fine and i get back a valid credentials object and i'm able to query items. The problem is when i call arcgisUtils.getItem() on a selected query item i get asked to authenticate once again. If i provide the login again the call then works and i can add the layer. How do i stop this double login though? Is there something i need to do with the returned credentials and the identityManager before calling getItem()?
My initial call to get credentials looks like this (edited for clarity):
identityManager.getCredential(_portal.url + "/sharing", {oAuthPopupConfirmation: false}).then((credential)=>{
_loggedInUser = credential.userId;
return _portal.signIn().then((result)=>{
return _loggedInUser;
});
});
this call results in a second login request:
getItemDetails(item){
return arcgisUtils.getItem(item.id);
}
If i use OAuth and a registered appId everything works great with just one login request. We want to give our users the ability to use or not use OAuth however so want both options to work.
thanks
mark
Ok got it. Since this was an Esri hosted organizational account i needed to use www.arcgis.com for the portal url and not our organizational url. Once i did this i only had to login once. So i simply need to test if its hosted or not.
mark