错误:“消息”:“无效的范围声明/角色”。 [英] Error: "message": "Invalid scope claims/roles."

查看:103
本文介绍了错误:“消息”:“无效的范围声明/角色”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试研究如何使用Graph restful API,并且我能够使用以下URL获取令牌和用户列表:

I'm trying to work out how to use the Graph restful API and I been able to get the Token and the user list using the below URL:

https://graph.microsoft.com/v1.0/users

https://graph.microsoft.com/v1.0/users

现在我要运行以下网址:  https ://graph.microsoft.com/v1.0/reports/getMailboxUsageMailboxCounts(句号='D7')

Now I want to run the following URL: https://graph.microsoft.com/v1.0/reports/getMailboxUsageMailboxCounts(period='D7')

但是当我运行此网址时,我收到以下错误:

but when I ran this URL I'm getting the below error:

{

  "错误":{

    "code":"S2SUnauthorized","
    "message":"无效范围声明/角色。","
    "innerError":{

      "request-id":" 9817ad26-4541-40cd-a60d-ca467848e826",&b $ b      "date":""2019-01-15T00:18:09""
    }¥b $ b  } b $ b}

{
  "error": {
    "code": "S2SUnauthorized",
    "message": "Invalid scope claims/roles.",
    "innerError": {
      "request-id": "9817ad26-4541-40cd-a60d-ca467848e826",
      "date": "2019-01-15T00:18:09"
    }
  }
}

任何人都可以提供帮助吗?

anyone can help?

谢谢

HY。

推荐答案

您需要在应用程序的注册中添加 Reports.Read.All 。 此外,请确保您对要添加或删除的范围提供管理员同意。 管理员同意可以通过简单的GET请求获得 
到https://login.microsoftonline.com/common/adminconsent以及以下查询参数:
client_id redirect_uri

例如 -  
https://login.microsoftonline.com/common/adminconsent?client_id= [APPLICATION ID]& redirect_uri = [REDIRECT URI]

You need to add Reports.Read.All to your application's registration.  Also, make sure that you are providing admin consent to the scope being added or removed.  Admin Consent can be given with a simple GET request  to https://login.microsoftonline.com/common/adminconsent along with the following query parameters : client_id and redirect_uri
For example - 
https://login.microsoftonline.com/common/adminconsent?client_id=[APPLICATION ID]&redirect_uri=[REDIRECT URI]


这篇关于错误:“消息”:“无效的范围声明/角色”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆