Select to view content in your preferred language

Persisted Credential deleted when calling GetCredentialAsync()

347
0
02-13-2026 01:18 PM
Labels (3)
EricLiu
Occasional Contributor

In my startup code, I set:

AuthenticationManager.Persistence = await CredentialPersistence.CreateDefaultAsync("testKey");

This gets me an AppDataCredentialPersistance. Then I would sign-in to arcgis.com and retrieve an OAuthUserCredential, which gets added to my AuthenticationManager. Upon restarting the app, it goes to my startup code again. After stepping over the line where I set the Persistence, I can see the CredentialPersistence's _credentials field indicate that I have 1 credential for arcgis.com. My AuthenticationManager also indicates I have 1 credential stored.

Next I call AuthenticationManager.GetCredentialAsync(request, true), which routes the call to my IChallengeHandler.CreateCredentialAsync() implementation. For some reason, between when I make the call and the call reaching my handler, I see my AGOL credential got deleted from both AuthenticationManager and the Persistence.

My request was for https:///www.arcgis.com, Token for AuthenticationType.

I found a similar report but on iOS.

https://community.esri.com/t5/swift-maps-sdk-questions/stored-credential-is-lost-upon-app-restart/td...

Edit: If I call FindCredential before calling GetCredentialAsync, I can get my persisted credential just fine. I'm mostly looking for confirmation / documentation clarifying if GetCredentialAsync is supposed to clear stored credentials ? 

 

0 Kudos
0 Replies