From c8a6df77ac65929cd4de898c1b76cdfdfb074a0d Mon Sep 17 00:00:00 2001 From: Dinuru Seniya Date: Fri, 2 May 2025 20:12:45 +1000 Subject: [PATCH] Outlook Auth Fix (#653) Issue: Account selector dialog pops up endlessly for Outlook/Live accounts. (Stored account not being correctly identified) Fix: Ignore case differences, add null safety and remove whitespaces when retrieving stored accounts. --- Wino.Authentication/OutlookAuthenticator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Wino.Authentication/OutlookAuthenticator.cs b/Wino.Authentication/OutlookAuthenticator.cs index d6afe732..10bc5f26 100644 --- a/Wino.Authentication/OutlookAuthenticator.cs +++ b/Wino.Authentication/OutlookAuthenticator.cs @@ -67,7 +67,8 @@ public class OutlookAuthenticator : BaseAuthenticator, IOutlookAuthenticator { await EnsureTokenCacheAttachedAsync(); - var storedAccount = (await _publicClientApplication.GetAccountsAsync()).FirstOrDefault(a => a.Username == account.Address); + var storedAccount = (await _publicClientApplication.GetAccountsAsync()).FirstOrDefault( + a => string.Equals(a.Username?.Trim(), account.Address?.Trim(), StringComparison.OrdinalIgnoreCase)); if (storedAccount == null) return await GenerateTokenInformationAsync(account);