Created
February 17, 2024 17:38
-
-
Save mr5z/916800453a81e3daa27fabf10dd9aaf3 to your computer and use it in GitHub Desktop.
Android.Maui - Seriously?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<TokenResponse> GetTokenResponse() | |
{ | |
var raw = Task.Run(async () => await SecureStorage.GetAsync(KeyTokenResponse)).Result | |
?? throw new InvalidOperationException($"'{nameof(TokenResponse)}' not found"); | |
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(raw), false); | |
return await JsonSerializer.DeserializeAsync<TokenResponse>(stream) | |
?? throw new InvalidOperationException($"Cannot deserialize '{nameof(TokenResponse)}'"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment