diff --git a/Selector.MAUI/Pages/Launch.razor b/Selector.MAUI/Pages/Launch.razor index 25dcc1d..36c4eb0 100644 --- a/Selector.MAUI/Pages/Launch.razor +++ b/Selector.MAUI/Pages/Launch.razor @@ -11,7 +11,7 @@ { logger.LogInformation("Starting up"); - //await sessionManager.LoadUserFromDisk(); + await sessionManager.LoadUserFromDisk(); if (sessionManager.IsLoggedIn) { diff --git a/Selector.MAUI/Services/SessionManager.cs b/Selector.MAUI/Services/SessionManager.cs index 516bda8..c1ba20f 100644 --- a/Selector.MAUI/Services/SessionManager.cs +++ b/Selector.MAUI/Services/SessionManager.cs @@ -22,7 +22,8 @@ public class SessionManager public async Task LoadUserFromDisk() { - var lastToken = await SecureStorage.Default.GetAsync(jwt_keychain_key); + //var lastToken = await SecureStorage.Default.GetAsync(jwt_keychain_key); + var lastToken = Preferences.Default.Get(jwt_keychain_key, string.Empty); lastStoredKey = lastToken; @@ -60,6 +61,8 @@ public class SessionManager lastRefresh = DateTime.Now; //await SecureStorage.Default.SetAsync(jwt_keychain_key, lastStoredKey); + // I know, but I can't get secure storage to work + Preferences.Default.Set(jwt_keychain_key, lastStoredKey); break; case SelectorNetClient.TokenResponseStatus.Malformed: @@ -80,5 +83,11 @@ public class SessionManager return tokenResponse.Status; } + + public void SignOut() + { + lastStoredKey = null; + Preferences.Default.Clear(); + } }