Код: Выделить всё
string clientId = "YOUR_CLIENT_ID";
string[] scopes = new string[] { "https://graph.microsoft.com/.default" };
string tenantId = "YOUR_TENANT_ID";
IConfidentialClientApplication app =
ConfidentialClientApplicationBuilder.Create(clientId)
.WithClientSecret("YOUR_CLIENT_SECRET")
.WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}"))
.Build();
AuthenticationResult result = await app.AcquireTokenForClient(scopes)
.ExecuteAsync();
string accessToken = result.AccessToken;
Console.WriteLine($"Access token: {accessToken}");
Как это сделать с помощью C#?
Подробнее здесь: https://stackoverflow.com/questions/781 ... er-using-c