Skip to content

Authority Override

pmaytak edited this page Jun 9, 2021 · 6 revisions

In many scenarios, such as client credential flow in multi-tenant apps, it is useful to specify the AAD tenant at the request level instead of the app level. However, the authority in the app and the request 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.microsoft.com/common", true)
                .Build();

var result = await app.AcquireTokenForClient(scopes)
                      .WithAuthority("https://login.microsoft.com/123456-1234-2345-1234561234");

An application instance can only deal with one cloud. If your app needs to handle multiple clouds at the same time, please create an app for each of them.

Getting started with MSAL.NET

Acquiring tokens

Desktop/Mobile apps

Web Apps / Web APIs / daemon apps

Advanced topics

News

FAQ

Other resources

Clone this wiki locally