saving token

This commit is contained in:
Andy Pack 2023-01-25 22:11:57 +00:00
parent bb764f3461
commit 8501c2ca7e
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
2 changed files with 11 additions and 2 deletions

View File

@ -11,7 +11,7 @@
{ {
logger.LogInformation("Starting up"); logger.LogInformation("Starting up");
//await sessionManager.LoadUserFromDisk(); await sessionManager.LoadUserFromDisk();
if (sessionManager.IsLoggedIn) if (sessionManager.IsLoggedIn)
{ {

View File

@ -22,7 +22,8 @@ public class SessionManager
public async Task LoadUserFromDisk() 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; lastStoredKey = lastToken;
@ -60,6 +61,8 @@ public class SessionManager
lastRefresh = DateTime.Now; lastRefresh = DateTime.Now;
//await SecureStorage.Default.SetAsync(jwt_keychain_key, lastStoredKey); //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; break;
case SelectorNetClient.TokenResponseStatus.Malformed: case SelectorNetClient.TokenResponseStatus.Malformed:
@ -80,5 +83,11 @@ public class SessionManager
return tokenResponse.Status; return tokenResponse.Status;
} }
public void SignOut()
{
lastStoredKey = null;
Preferences.Default.Clear();
}
} }