AnsweredAssumed Answered

[RESOLVED] How to destroy a single credential from many?

Question asked by michal.gasparovic@bhp.com_bhp on Feb 14, 2020
Latest reply on Feb 16, 2020 by michal.gasparovic@bhp.com_bhp

Hi,

 

I have a web application that requires user to switch between different portals (AGOL + 2x on-prem PORTALS). Each time the requested resource requires a portal access, I'm switching using the immediate authentication option. This all works ok. If not logged in I use OAuth2.0.

 

However, I wanted to add the option of sign-out of the portal, so I'm receiving the credential from identity manager and destroy it. However, I've noticed that that credentials still exist within the IdentityManager.credentials and also in the local storage under esriJSAPIOAuth .

 

However, if I use IdentityManager.destroyCredentials() it works, but that's not what I want.

 

const credential = this.identityManager.findCredential(url);
if (credential && asset !== 'agol') {
  console.log(`Authentication.service.ts: logout: LOGGING OUT user: ${credential.userId}. [${asset} (${url})]`);
  credential.destroy();
}

 

Any ideas? OR do I have to do it manually ? 

 

Thank you

Outcomes