【发布时间】:2021-03-15 07:26:37
【问题描述】:
我正在尝试使用 Microsoft 在 NuGet 中提供的 Graph SDK 访问 Office 365 用户,我的代码是:
var cca = ConfidentialClientApplicationBuilder
.Create("ClientId")
.WithClientSecret("ClientSecret")
.WithTenantId("TenantId")
.Build();
List<string> scopess = new List<string>();
scopes.Add("https://graph.microsoft.com/.default");
scopes.Add("Calendars.Read");
// i tried each scope alone and same result
var authenticationProvider = new AuthorizationCodeProvider(cca, scopes.ToArray());
GraphServiceClient graphClient = new GraphServiceClient(authenticationProvider);
var x = await graphClient.Users.Request().GetAsync();
在最后一行我得到了错误
需要身份验证挑战
我的 Azure Active Directory 应用注册设置是:
可能我做错了什么,但不确定是什么! 我使用 Microsoft Docs 作为参考
【问题讨论】:
标签: azure azure-active-directory microsoft-graph-api office365