Select to view content in your preferred language

WPF OAuth Stay Logged In

1021
1
07-08-2020 11:27 PM
Labels (1)
CharlesRakaczky
New Contributor

I want to have the user stay logged in on application close. I'm using OAuth to log the user in and working with v100.8.0.

The AllowSaveCredentials option shown in the OAuth .NET Guide seems to be the key, but I think it may not be available on WPF. I can't see Esri.ArcGISRuntime.Toolkit.Security, even with the Toolkit package installed.

Tags (2)
0 Kudos
1 Reply
by Anonymous User
Not applicable

Since you're working with 100.8, we actually have a convenient way for you to store credentials by implementing the abstract class CredentialPersistence. By assigning an instance of this class to AuthenticationManager.Current.Persistence, you can receive callbacks from the AuthenticationManager regarding when credentials should be added, removed, and updated so that you can store them securely.

If you assign a new CredentialPersistence instance when your program starts, the AuthenticationManager will request any credentials you stored with it previously. In this way, you can keep the user signed on between sessions.

As for how you can implement secure credential storage yourself, I recommend starting by looking into the Data Protection API. Using this API you will be able to store encrypted copies of serialized credentials on the user's computer.

In the future we plan to offer default implementations for CredentialPersistence and WPF is under consideration for this.

0 Kudos