简体   繁体   English

Azure Active Directory和Avocado API身份验证

[英]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.

相关问题 使用 Azure Active Directory 的 Azure Function 身份验证 - Azure Function authentication using Azure Active Directory 使用活动目录API DirectoryEntry进行身份验证 - Authentication with active directory API DirectoryEntry ASP.NET中的Azure Active Directory身份验证 - Azure active directory authentication in asp.net 如何挑战Windows Azure Active Directory身份验证? - How to challenge Windows Azure Active Directory authentication? 使用 Angular 8 和 Azure Active Directory 进行身份验证 - Authentication using Angular 8 with Azure Active Directory 使用身份框架进行用户身份验证的 Azure Active Directory 身份验证和现有应用程序。 使用 ADAL 或 Web Api - Azure Active Directory Authentication with and Existing App which is using Identity framework for user authentication. Using ADAL or Web Api 通过 Active Directory 进行 Web API 身份验证 - Web API authentication via Active Directory 未连接到Azure Active Directory的Office 365 API - Office 365 API that is not connected to Azure Active Directory 通过Web API授权激活活动目录 - Authorization to azure active directory through web api Asp.net Identity使用密码和Azure Active Directory身份验证 - Asp.net Identity using password and Azure Active Directory authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM