微软图形API使用Postman(错误user_impersonation)。

问题描述 投票:0回答:1

我正在使用Postman与微软图形API合作。当我读写用户或组等资源时,一切都很好,但当我发送一个请求来获取用户活动时。

GET https://graph.microsoft.com/v1.0/users/{user-id}/activities

我得到了这个错误。

Security Token does not contain a scope claim of user_impersonation or an expected scope

那么,我在哪里可以找到"用户_人格化"如何获取用户活动?

Ps: 我试着在我的应用程序中创建新的范围,如果这是正确的方法。我如何在Postman请求中使用该作用域?

postman azure-ad-graph-api
1个回答
0
投票

我假设你试图检索一个不是经过认证的用户的用户,是否正确?I.E token中的ID !=用户的id?

在这个例子中,客户端和Microsoft Graph之间不存在用户的同意。客户端已注册了 user.read 和 contacts.read 权限,以及 Azure Key Vault 范围。https:/vault.azure.netuser_impersonation。. 当客户机请求scope=的令牌时。https:/graph.microsoft.com.default。用户将看到一个同意屏幕,显示 user.read、contacts.read 和 Key Vault user_impersonation 作用域。返回的令牌将只有user.read和contacts.read作用域,并且只能针对Microsoft Graph使用。

来源于:https:/docs.com https:/docs.microsoft.comen-gbazureactive-directorydevelopv2-permissions-and-consent。

在我看来(从来没有使用过Azure),这更多的是OAuth2造成的问题,而不是Azure,我可以尝试添加范围。https:/vault.azure.netuser_impersonation。 当验证oauth2token或任何端点时。

我可以看看Vault的文档,看看他们是否在某个地方引用了缺失的作用域,或者尝试一下Vault的完整URL。scope 的有效载荷。

© www.soinside.com 2019 - 2024. All rights reserved.