none
Error: "message": "Invalid scope claims/roles." RRS feed

  • Question

  • Hi All,

    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

    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:

    {
      "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?

    Thanks

    HY.



    • Edited by HalYamanMVP Tuesday, January 15, 2019 1:03 AM
    Tuesday, January 15, 2019 12:59 AM

All replies

  • 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]

    Wednesday, January 30, 2019 6:56 AM