Skip to content

Instantly share code, notes, and snippets.

@mmierzwa
Created April 24, 2017 08:13
Show Gist options
  • Save mmierzwa/3692b6cc9d7a26c167e661879e61786a to your computer and use it in GitHub Desktop.
Save mmierzwa/3692b6cc9d7a26c167e661879e61786a to your computer and use it in GitHub Desktop.
Cleaning ADAL token cache on Android and iOS
public class SecureStorageService : ISecureStorageService
{
private const string SharedPreferencesName = "ActiveDirectoryAuthenticationLibrary";
private const string SharedPreferencesKey = "cache";
private static ISharedPreferences SharedPreferences =>
Application.Context.GetSharedPreferences(SharedPreferencesName, FileCreationMode.Private);
public void RemoveAdalRecords()
{
try
{
var editor = SharedPreferences.Edit();
editor.Remove(SharedPreferencesKey);
}
catch (Exception ex)
{
// log the error
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment