Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CommunityToolkit.Authentication.Uwp/WindowsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class WindowsProvider : BaseProvider
private const string MicrosoftProviderId = "https://login.microsoft.com";
private const string SettingsKeyAccountId = "WindowsProvider_AccountId";
private const string SettingsKeyProviderId = "WindowsProvider_ProviderId";
private const string SettingsKeyProviderAuthority = "WindowsProvider_Authority";

private static readonly SemaphoreSlim SemaphoreSlim = new (1);

Expand Down Expand Up @@ -355,6 +356,7 @@ private async Task SetAccountAsync(WebAccount account)
_webAccount = account;
Settings[SettingsKeyAccountId] = account.Id;
Settings[SettingsKeyProviderId] = account.WebAccountProvider.Id;
Settings[SettingsKeyProviderAuthority] = account.WebAccountProvider.Authority;

State = ProviderState.SignedIn;
}
Expand All @@ -370,9 +372,10 @@ private async Task<WebTokenRequestResult> AuthenticateSilentAsync(string[] scope
{
// Check the cache for an existing user
if (Settings[SettingsKeyAccountId] is string savedAccountId &&
Settings[SettingsKeyProviderId] is string savedProviderId)
Settings[SettingsKeyProviderId] is string savedProviderId &&
Settings[SettingsKeyProviderAuthority] is string savedProviderAuthority)
{
var savedProvider = await WebAuthenticationCoreManager.FindAccountProviderAsync(savedProviderId);
var savedProvider = await WebAuthenticationCoreManager.FindAccountProviderAsync(savedProviderId, savedProviderAuthority);
account = await WebAuthenticationCoreManager.FindAccountAsync(savedProvider, savedAccountId);
}
}
Expand Down