Skip to content

Commit

Permalink
Use authorityUrl instead of tenantId when initializing MSAL.
Browse files Browse the repository at this point in the history
  • Loading branch information
peombwa committed Jun 7, 2023
1 parent af18000 commit 73c3b19
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Microsoft.Graph.PowerShell.Authentication.Helpers
/// </summary>
public static class AuthenticationHelpers
{
static ReaderWriterLockSlim _cacheLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
static readonly ReaderWriterLockSlim _cacheLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

/// <summary>
/// Signs out of the current session using the provided <see cref="IAuthContext"/>.
Expand Down Expand Up @@ -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()
Expand All @@ -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();
Expand Down

0 comments on commit 73c3b19

Please sign in to comment.