【发布时间】:2017-01-06 17:41:22
【问题描述】:
我有下面的代码
string aadInstance = "https://login.windows.net/{0}";
string tenant = "<tenant>.onmicrosoft.com";
string clientId = "d22d1d2a-...";
Uri redirectUri = new Uri("http://redirect");
string authority = String.Format(aadInstance, tenant);
string apiResourceId = "https://<resource>.onmicrosoft.com/sample";
string apiBaseAddress = "http://localhost:9003/";
AuthenticationContext authContext = authContext = new AuthenticationContext(authority);
AuthenticationResult authResult = authContext.AcquireToken(apiResourceId, clientId, redirectUri);
我已将应用程序作为本机应用程序添加到活动目录中,但出现错误。 “AADSTS50001:在名为 .onmicrosoft.com 的租户中找不到名为 .onmicrosoft.com/sample">https://.onmicrosoft.com/sample 的应用程序。如果租户管理员未安装应用程序或未获得租户中任何用户的同意,则可能会发生这种情况。您可能将身份验证请求发送给了错误的租户。”
我对 apiresource id 应该是什么感到困惑,如果可能的话,请给我关于如何在本机和 web api 应用程序中配置应用程序的快照,资源 id 和租户 id 名称应该在哪里等等,我我也对“其他应用程序的权限”感到困惑,我正在搜索不可见的“鳄梨”。
【问题讨论】: