azure - MS Graph Api 缺少权限

标签 azure microsoft-graph-api microsoft-teams

我将该应用部署到 Teams。 如果我没有以管理员身份登录,则会收到此错误:

HTTPMessageHandler.ts:31          GET https://graph.microsoft.com/v1.0/planner/plans/prpAA7SlvE6gwSEEjcESs5gACiII/tasks 403 (Forbidden)
GraphErrorHandler.ts:62 Uncaught (in promise) Error: You do not have the required permissions to access this item.
at Function.value (GraphErrorHandler.ts:62:18)
at GraphErrorHandler.ts:89:31
at l (regeneratorRuntime.js:72:17)
at Generator.\_invoke (regeneratorRuntime.js:55:24)
at Generator.next (regeneratorRuntime.js:97:21)
at tslib.es6.js:74:71
at new Promise (\<anonymous\>)
at gs (tslib.es6.js:70:12)
at Function.value (GraphErrorHandler.ts:86:106)
at e.\<anonymous\> (GraphRequest.ts:386:37)

https://admin.teams.microsoft.com/我已获得管理员批准这些权利: enter image description here

在 azure 门户中,我已批准以下权利: enter image description here

在APP代码中我设置:

"requiredResourceAccess": [
        {
            "resourceAppId": "Microsoft Graph",
            "resourceAccess": [
                {
                    "id": "Tasks.ReadWrite",
                    "type": "Scope"
                },
                {
                    "id": "Tasks.Read.Shared",
                    "type": "Scope"
                },
                {
                    "id": "User.Read",
                    "type": "Scope"
                },
                {
                    "id": "User.ReadBasic.All",
                    "type": "Scope"
                },
                {
                    "id": "Calendars.Read",
                    "type": "Scope"
                },
                {
                    "id": "Files.Read.All",
                    "type": "Scope"
                },
                {
                    "id": "Sites.Read.All",
                    "type": "Scope"
                },
                {
                    "id": "Group.Read.All",
                    "type": "Scope"
                },
                {
                    "id": "Group.ReadWrite.All",
                    "type": "Scope"
                },
                {
                    "id": "Tasks.Read",
                    "type": "Scope"
                },
                {
                    "id": "People.Read",
                    "type": "Scope"
                }
            ]
        }
    ],

最后

"signInAudience": "AzureADMyOrg"

我真的不知道我出了什么问题,也不知道为什么组织中的用户仍然没有必要的权限。我缺少什么?

最佳答案

列表tasks对于计划,您不需要所有这些权限。你所拥有的太过分了。

您只需要其中一项权限。

  • 任务.阅读
  • 任务.ReadWrite
  • 群组.阅读.全部
  • Group.ReadWrite.All

因此,要仅读取计划任务,您实际上只需要委派任务。只读,无需其他任何内容。

如果您使用应用程序身份验证,则无法使用此 API,它需要经过身份验证的用户 beaer token 才能使用此 API。

当使用无权查看该计划的用户时,我通常会在此 API 中看到“禁止”。

一个plan belongs to a group ,因此访问计划的用户必须是该组的成员才能查看计划和计划任务。

您应该能够使用 Graph Explorer 来试验此 API针对示例租户或登录并针对您自己的租户使用它。

关于azure - MS Graph Api 缺少权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74340075/

相关文章:

azure - 为什么不总是配置事件中心分区的最大数量?

amazon-web-services - 如何在 Microsoft Azure 上部署 Ultralytics YOLOv8?

azure-active-directory - 通过 Graph API 访问 Office 365

powershell - Microsoft Teams 访问策略有问题 - New-CsApplicationAccessPolicy

azure - 在哪里可以找到 Bot Framework 所需的 ID?

.net - 部署在本地 IIS 中时,azure 消息传递服务未接收消息

azure - 发送到服务总线时出现OperationCanceledException

azure - msgraph-sdk-go 无法为一个用户创建两个以上的扩展

microsoft-graph-api - 创建事件不确认传入的时区

microsoft-teams - 新的 MicrosoftTeams.authentication.getAuthToken 不是 MS Graph Bearer : token?