From 73c3b193e5cf43b910efc16d4c0c3c530cd90805 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 7 Jun 2023 11:27:49 -0700 Subject: [PATCH] Use authorityUrl instead of tenantId when initializing MSAL. --- .../Authentication.Core/Utilities/AuthenticationHelpers.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs b/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs index d75ad1e2d78..86d4993c324 100644 --- a/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs +++ b/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs @@ -23,7 +23,7 @@ namespace Microsoft.Graph.PowerShell.Authentication.Helpers /// public static class AuthenticationHelpers { - static ReaderWriterLockSlim _cacheLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); + static readonly ReaderWriterLockSlim _cacheLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); /// /// Signs out of the current session using the provided . @@ -71,7 +71,6 @@ public static IAuthenticationProvider GetAuthProvider(IAuthContext authContext) //https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/MSAL.NET-uses-web-browser IPublicClientApplication publicClientApp = PublicClientApplicationBuilder .Create(authContext.ClientId) - .WithTenantId(authContext.TenantId) .WithAuthority(authorityUrl) .WithClientCapabilities(new[] { "cp1" }) .WithDefaultRedirectUri() @@ -98,7 +97,6 @@ public static IAuthenticationProvider GetAuthProvider(IAuthContext authContext) { IConfidentialClientApplication confidentialClientApp = ConfidentialClientApplicationBuilder .Create(authContext.ClientId) - .WithTenantId(authContext.TenantId) .WithAuthority(authorityUrl) .WithCertificate(GetCertificate(authContext)) .Build();