gpt4 book ai didi

java - 图错误: Invoked API requires Protected API access in application-only context when not using Resource Specific Consent

转载 作者:行者123 更新时间:2023-12-02 22:57:33 24 4
gpt4 key购买 nike

我正在尝试创建一个 api,将消息发送到团队中的特定 channel 或群组。

我正确地遵循了文档。在Azure中,我向我的应用程序授予了所有权限。她配置了 tenandId、clientId 和 SecretId,但是当我发送请求时,我得到了这个返回。

有谁知道解决方案或遇到过此错误吗?

enter image description here

enter image description here

文档: https://learn.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-1.0&tabs=javascript

最佳答案

您的代码当前正在尝试使用 GET HTTP 请求(即代码中的 .get() 部分)来读取消息

如果您想要发送消息,那么您需要通过将 .get() 更改为 来发出 POST 请求。发布(channelMessage)

有关 protected API 的更多信息

根据"Protected APIs" documentation :

Microsoft Teams APIs in Microsoft Graph that access sensitive dataare considered protected APIs. These APIs require that you haveadditional validation, beyond permissions and consent, before you canuse them.

个人消息似乎是敏感数据,这是有道理的。但请注意,还有一种替代解决方案,您可以像用户使用 API 一样使用 API。它被称为Delegated permissions .

Delegated permissions are used by apps that have a signed-in userpresent. For these apps, either the user or an administrator consentsto the permissions that the app requests and the app can act as thesigned-in user when making calls to Microsoft Graph. Some delegatedpermissions can be consented by non-administrative users, but somehigher-privileged permissions require administrator consent.

如果您无法选择委派权限,您仍然可以向 Microsoft Graph 发出正式请求,请求获得使用 API 的权限,而无需任何用户交互。

To request access to these protected APIs, complete the followingrequest form. We review access requests every Wednesday and deployapprovals every Friday, except during major holiday weeks in the U.S.Submissions during those weeks will be processed the followingnon-holiday week.

Here is the form for sending a formal request.

关于java - 图错误: Invoked API requires Protected API access in application-only context when not using Resource Specific Consent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69305372/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com