我怎么知道我需要为Microsoft Identity Platform/Azure AD/MSAL应用设置哪些权限?

发布于 2025-02-06 17:33:32 字数 594 浏览 3 评论 0 原文

我知道如何在Azure AD中注册全部。我也知道如何使用MSAL检索访问令牌。当我提出请求时,我会收到此错误:

$ curl https://graph.microsoft.com/v1.0/me -H "Authorization: Bearer ${ACCESS_TOKEN}"
{
  "error": {
    "code": "ErrorInsufficientPermissionsInAccessToken",
    "message": "Exception of type 'Microsoft.Fast.Profile.Core.Exception.ProfileAccessDeniedException' was thrown.",
    "innerError": {
      "date": "2022-06-11T18:41:12",
      "request-id": "c5af5903-d4d1-4a6c-bdf4-9c059f865345",
      "client-request-id": "c5af5903-d4d1-4a6c-bdf4-9c059f865345"
    }
  }
}

有没有办法知道您需要从错误消息中设置哪些API权限和范围?

I know how to register an all in Azure AD. I also know how to retrieve an access token with MSAL. When I make a request I get this error:

$ curl https://graph.microsoft.com/v1.0/me -H "Authorization: Bearer ${ACCESS_TOKEN}"
{
  "error": {
    "code": "ErrorInsufficientPermissionsInAccessToken",
    "message": "Exception of type 'Microsoft.Fast.Profile.Core.Exception.ProfileAccessDeniedException' was thrown.",
    "innerError": {
      "date": "2022-06-11T18:41:12",
      "request-id": "c5af5903-d4d1-4a6c-bdf4-9c059f865345",
      "client-request-id": "c5af5903-d4d1-4a6c-bdf4-9c059f865345"
    }
  }
}

Is there a way to know which API permissions and scopes you need to set up from the error message?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谎言月老 2025-02-13 17:33:32

设置API权限和范围取决于您要调用Microsoft Graph的请求。

您可以通过 microsoft Graph Rest REST REST API V1.0参考/a>

请注意, /me 用于获取签名用户的用户信息。

在调用/me 端点时检查下面的注意

“在此处输入图像说明”

必需 permissions 用于调用/strong> me 端点是:

“在此处输入映像”

我在环境中测试并得到了概要符合下面的授权权限,如下所示:

“在此处输入映像说明”

API权限 我给了该应用程序:

“在此处输入映像说明”

您可以找到类似的 Microsoft Q& a 下面提出的问题:

Setting up API permissions and scopes depends on the request you are making to call Microsoft Graph.

You can find the required permissions for every Graph API request via Microsoft Graph REST API v1.0 reference

Please note that /me is used to get user information of signed-in user.

Check the below note while calling /me endpoint :

enter image description here

Required permissions for calling /me endpoint are:

enter image description here

I tested in my environment and got the profile successfully with Delegated permission like below:

enter image description here

API Permissions that I have given to the app:

enter image description here

You can find similar kind of problem raised in Microsoft Q&A below:

ErrorInsufficientPermissionsInAccessToken - Microsoft Q&A

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文