Skip to content

SP Online - "getOffice365GroupsActivityDetail" Graph API call fails under the SPFx #5845

Description

@zorayr

Category

  • Bug

Describe the bug

The MS Graph REST API call getOffice365GroupsActivityDetail fails with status "403 - S2SUnauthorized" under the SPFx using MSGraphClient.

Steps to reproduce

All screenshots are provided below in Additional context section.

  1. Create an SPFx web part project
  2. Add Reports.All.Read Delegated permission, approve it (see screenshots 1 and 2)
  3. Use MSGraphClient for MS Graph API calls and this method .api("/reports/getOffice365GroupsActivityDetail(period='D180')").get(...
  4. Use Tenant Admin with enough permissions (see the screenshot 3)
  5. Run the project, do the call
  6. It fails with status code 403 - Forbidden, with error code S2SUnauthorized and error message Invalid Permission. (see screenshots 4 and 5)

Expected behavior

Expected behavior is to retrieve the report data, as all requirements are met according to the documentation.

Environment details (development & target environment)

  • Developer Environment: Windows 10
  • Target Environment: SharePoint Online
  • Framework: .NET Framework v3.x
  • Browser(s): Chrome v79
  • Tooling: VS Code

Additional context

Here are some screenshots mentioned above:
Screenshot 1:
image

Screenshot 2:
image

Screenshot 3:
image

Screenshot 4:
image

Screenshot 5:
image

Here is the bearer token used during the call:

eyJ0eXAiOiJKV1QiLCJub25jZSI6Inc3alZUWTNZTUtQRE5jVWpFaVZKU0s5N3RWYU5xd1lKYXlGanJ3ZnR1b2siLCJhbGciOiJSUzI1NiIsIng1dCI6IkN0VHVoTUptRDVNN0RMZHpEMnYyeDNRS1NSWSIsImtpZCI6IkN0VHVoTUptRDVNN0RMZHpEMnYyeDNRS1NSWSJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC82MDRhYzcyMi0xYTBmLTRkNDMtYmIzOC03ZWU0YWEzMTBmMzIvIiwiaWF0IjoxNTkxMDgyNjQ2LCJuYmYiOjE1OTEwODI2NDYsImV4cCI6MTU5MTA4NjU0NiwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkFTUUEyLzhQQUFBQW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z0LmNvbSIsInV0aSI6InhpRUQyNU9KdTA2akpONGRpNFVYQUEiLCJ2ZXIiOiIxLjAiLCJ4bXNfdGNkdCI6MTQ2Mjg3MzM5OX0.rJSVzDVbMA6sja6I3MXD8RgZI4rzqQD3QRmaLWVNEw7Q9U1mXt8KyCSIKCufUlPPeC6nW2pJsTTpzJjYxCEmO_NUMAW3rfvpV7aHrVTdJ1GGHns_Q7ZvrBeNFRJ25asMH7mTBSTDP0x1p_0TON5ewg9TlVmUlXSKvpd-5Y3nKftbLEOvTHCFThhHZBYDkAW6Xz3sJlXcviX9lomC8TpG5iNsRBm6wkljaUrZx_2RScmzaZ_n7l1OjaWPY4sIyKeyc1j7VzMGJ6eTn-p4pbipRiSYb4AWXxl81guZKoI0nlHkEJCvHxmst4IxhObwMwHLBKeba6uImdKUSTuF_glu_A

As we can see from the parsing, the token includes required permission to read the report.
Screenshot 6:
image

Thanks a lot !

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authCategory: Authentication (Azure AD / etc)area:docsCategory: SharePoint developer/development documentation relatedarea:spfxCategory: SharePoint Framework (not extensions related)status:by-designTopic described is by design & not considered an issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions