Skip to content

Use authorityUrl instead of tenantId when initializing MSAL #2073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2023
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
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