From 70ae53204c344c1b74bad19b718de87ccee68784 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Tue, 24 Feb 2026 11:58:58 -0800 Subject: [PATCH] Re-establish seperate auth paths for WAM enabled/disabled --- .../Utilities/AuthenticationHelpers.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs b/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs index 8080206dd3..c781788e7e 100644 --- a/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs +++ b/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs @@ -127,11 +127,18 @@ private static async Task GetInteractiveBrowserCre if (ShouldUseWam(authContext)) { GraphSession.Instance.OutputWriter.WriteWarning("Note: Sign in by Web Account Manager (WAM) is enabled by default on Windows. If using an embedded terminal, the interactive browser window may be hidden behind other windows."); + authRecord = await Task.Run(() => + { + return interactiveBrowserCredential.Authenticate(new TokenRequestContext(authContext.Scopes), cancellationToken); + }); } - authRecord = await Task.Run(() => + else { - return interactiveBrowserCredential.Authenticate(new TokenRequestContext(authContext.Scopes), cancellationToken); - }); + authRecord = await Task.Run(() => + { + return interactiveBrowserCredential.AuthenticateAsync(new TokenRequestContext(authContext.Scopes), cancellationToken); + }); + } await WriteAuthRecordAsync(authRecord).ConfigureAwait(false); return interactiveBrowserCredential; }