-
Notifications
You must be signed in to change notification settings - Fork 378
Authority Override
In many scenarios, such as client credential flow in multi-tenant apps, it is useful to specify the Azure AD tenant in the request builder instead of the application builder. WithTenantId is the recommended API to use in this scenario, which accepts the tenant ID string. WithTenantIdFromAuthority is another similar method that is available in MSAL 4.46.0+. You can also use WithAuthority, however, the authority in the application and the request builders must always be for the same cloud, i.e. the host of the authority URL must not be different.
var app = ConfidentialClientApplicationBuilder
.Create(PublicCloudConfidentialClientID)
.WithAuthority("https://login.microsoftonline.com/common", true)
.Build();
var result = await app.AcquireTokenForClient(scopes)
.WithTenantId("123456-1234-2345-1234561234");
// OR
var result = await app.AcquireTokenForClient(scopes)
.WithTenantIdFromAuthority("https://login.microsoftonline.com/123456-1234-2345-1234561234");A public or confidential client application instance can only be associated with one cloud. If your client application needs to handle multiple clouds at the same time, create a separate public of confidential client instance for each of them.
- Home
- Why use MSAL.NET
- Is MSAL.NET right for me
- Scenarios
- Register your app with AAD
- Client applications
- Acquiring tokens
- MSAL samples
- Known Issues
- Acquiring a token for the app
- Acquiring a token on behalf of a user in Web APIs
- Acquiring a token by authorization code in Web Apps
- AcquireTokenInteractive
- WAM - the Windows broker
- .NET Core
- Maui Docs
- Custom Browser
- Applying an AAD B2C policy
- Integrated Windows Authentication for domain or AAD joined machines
- Username / Password
- Device Code Flow for devices without a Web browser
- ADFS support
- High Availability
- Regional
- Token cache serialization
- Logging
- Exceptions in MSAL
- Provide your own Httpclient and proxy
- Extensibility Points
- Clearing the cache
- Client Credentials Multi-Tenant guidance
- Performance perspectives
- Differences between ADAL.NET and MSAL.NET Apps
- PowerShell support
- Testing apps that use MSAL
- Experimental Features
- Proof of Possession (PoP) tokens
- Using in Azure functions
- Extract info from WWW-Authenticate headers
- SPA Authorization Code