[英]Azure Active Directory and avocado api authentication
I 'm having the below code 我有下面的代码
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);
I have added the application as native application in active directory and I 'm getting the error. 我已将应用程序添加为活动目录中的本机应用程序,但出现了错误。 "AADSTS50001: The application named .onmicrosoft.com/sample">https://.onmicrosoft.com/sample was not found in the tenant named .onmicrosoft.com.
“ AADSTS50001:在名为.onmicrosoft.com的租户中找不到名为.onmicrosoft.com / sample“> https://.onmicrosoft.com/sample的应用程序。 This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant.
如果租户的管理员未安装该应用程序,或者该租户中的任何用户未同意该应用程序,则可能会发生这种情况。 You might have sent your authentication request to the wrong tenant."
您可能已将身份验证请求发送给错误的租户。”
I 'm confused about what should be apiresource id, if possible please give me the snapshots of how to configure the application both in native and web api application, where should be the resource id and tenant id names and so on, I 'm also confused about "Permissions to other application" where in I ' m searching for "avocado" which is not visible. 我对apiresource id应该是什么感到困惑,如果可以的话,请给我有关如何在本机和Web api应用程序中配置应用程序的快照,其中应该是资源ID和承租人ID名称,等等,我也是对于“其他应用程序的权限”感到困惑,我在其中搜索不可见的“鳄梨”。
Based on the error message, it seems that you were using the incorrect resource when you were requesting the access token. 根据错误消息,您在请求访问令牌时似乎使用了错误的资源 。
The resource should be the APP ID URI which web API the native app consumes, you can find it through the old portal like figure below: 该资源应该是本机应用程序使用的Web API的APP ID URI ,您可以通过旧的门户网站找到它,如下图所示:
We can also find it on the new portal via Azure Active Directory->App registrations->{You app}->Properties: 我们还可以通过Azure Active Directory->应用程序注册-> {You app}->属性在新门户上找到它:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.