AnsweredAssumed Answered

Double login to portal and identityManager when not using OAuth

Question asked by mark3773 on Oct 1, 2015
Latest reply on Oct 1, 2015 by mark3773

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

Outcomes