我正在尝试使用已注册的应用程序 clientCredentials 从 Azure 数据目录中检索数据。我可以很好地获得不记名令牌,但是当我尝试将令牌与 Azure 数据目录 API 一起使用时,我得到 -
WWW-Authenticate: Bearer realm="svc", error="InsufficientScope", error_description="A token with user_impersonation scope is required.", scope="user_impersonation"
X-Powered-By: ASP.NET
401 - Unauthorized: Access is denied due to invalid credentials.
You do not have permission to view this directory or page using the credentials that you supplied.
我已授予应用程序针对 AD 和 ADC 的权限,并且还在 AD 中的应用程序中添加了贡献者角色。
不知道为什么会这样……让我发疯。
我可以在控制台应用程序中使用用户密码凭据来完成这项工作,但是当我尝试在 Web 应用程序中执行此操作时,它就会崩溃。
干杯