Um diesen Anbieter nutzen zu können, muss ich den von einer Weiterleitung zurückgegebenen Autorisierungscode abrufen und übergeben. Dies ist der Teil, bei dem ich nicht sicher bin, wie ich an diesen Code komme, obwohl ich sehe, dass er im Browser zurückgegeben wird.
Code: Select all
// Values from app registration
var clientId = "YOUR_CLIENT_ID";
var clientSecret = "YOUR_CLIENT_SECRET";
// For authorization code flow, the user signs into the Microsoft
// identity platform, and the browser is redirected back to your app
// with an authorization code in the query parameters
var authorizationCode = "HOW_DO_I_GET_THIS_CODE????";
// using Azure.Identity;
var options = new AuthorizationCodeCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
};
// https://learn.microsoft.com/dotnet/api/azure.identity.authorizationcodecredential
var authCodeCredential = new AuthorizationCodeCredential(
tenantId, clientId, clientSecret, authorizationCode, options);