OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
685 stars 95 forks source link

Excel: Error from multiple endpoints—"You do not have permissions to open this file in the browser." #4506

Open robertscl opened 5 months ago

robertscl commented 5 months ago

Hi there, I'm writing from the Support Engineering team at Zapier. We were encouraged by a contact at Microsoft to open this issue here.

Starting around mid-February, and ramping up from mid-March to the present, users began reporting instances of the following error when attempting to use Zapier's Excel integration:

You do not have permissions to open this file in the browser (response status code 401)

In more detail (truncated for security):

{
  "error": {
    "code": "FileOpenUserUnauthorized",
    "message": "You do not have permissions to open this file in the browser.",
    "innerError": {
      "code": "unauthorizedUncategorized",
      "message": "Required authentication information for the resource is either missing or invalid.",
      "innerError": {
        "code": "FileOpenUserUnauthorized",
        "message": "You do not have permissions to open this file in the browser."
      },
      "date": "2024-03-21T18:46:07",
      ...
    }
  }
}

Specifically, we're seeing this in two contexts:

First, when making a GET request to list worksheets:

https://graph.microsoft.com/v1.0/me/drive/items('{redacted}')/workbook/worksheets

Here's what that looks like within Zapier's UI:

fetch worksheets

This would normally populate a dropdown list, showing all available worksheets.

Second, when making a POST request to initiate a session:

https://graph.microsoft.com/v1.0/me/drive/items('{redacted}')/workbook/createSession

It's possible more endpoints are affected, but these are the one's we're primarily seeing return this error.

A few important details:

Your Environment

Expected behavior

If users have sufficient permission and the necessary scopes to work with a given Excel spreadsheet and/or worksheet, the /worksheets and /createSession API endpoints should return a successful response, allowing Zapier to fetch worksheet lists and perform additional automations on the users' behalf.

Current behavior

For a subset of users (trend unclear), the Excel/worksheets and /createSession API endpoints return response status code 401 and the error You do not have permissions to open this file in the browser despite the user being authenticated and having sufficient permission to access/edit the file in OneDrive.

This prevents users from configuring "Zaps" (workflow automations)(pictured above) and prevents Zapier from performing automations on the user's behalf.

Steps to reproduce

  1. Sign in (or create an account) at https://zapier.com/app/login
  2. Click "+ Create" to create a new Zap (automation)
  3. Add an Excel step to the Zap
  4. As the action, select "Find Row"

find row

  1. In the next substep, connect your Excel account
  2. In the next substep, select a spreadsheet from the Spreadsheet dropdown
  3. Attempt to select a worksheet from the Worksheet dropdown.

editor

Please note, this issue does not seem to impact all accounts, so it might work just fine for you—you might see a list of worksheets as expected instead of an empty list. We've been unable to pinpoint a common denominator amongst those impacted.

Link to live example(s)

Zapier:

Make:

Please note, Make suggests that they might already be in touch with you about a similar issue.

Microsoft Q&A:

Provide additional details

We've been able to reproduce a similar behavior outside of Zapier. When we call the list worksheets endpoint withworkbook/worksheets, we see the error.

full path

When we remove workbook/worksheets, however, we get a successful response:

working

Context

How has this issue affected you?

Some Zapier users are currently unable to use the Excel integration.

Zapier cannot list the user's worksheets or find or create rows on their behalf.

shanshanzheng-dev commented 5 months ago

Hi @robertscl Thanks for reporting this issue. We'll be looking into this problem, could you provide us with the latest repro request id and the exact timestamp?

robertscl commented 5 months ago

Thank you, @shanshanzheng-dev !

Certainly, I just reproduced the issue internally. Here are those details:

Here is a fuller log, although I've removed a few headers for privacy:


timestamp: 2024-05-28T13:23:39.002Z

--------------------------------------------------------------------------------
REQUEST
--------------------------------------------------------------------------------

GET https://graph.microsoft.com/v1.0/me/drive/items('6644E81F279DABAB!sd175bfbe14ff44f9b26cad4be6d48f16')/workbook/worksheets

--------------------------------------------------------------------------------
RESPONSE
--------------------------------------------------------------------------------

401

Request-Id: 9c5e7705-5db3-497c-9b1c-cfd9dec53bb3
Client-Request-Id: 9c5e7705-5db3-497c-9b1c-cfd9dec53bb3
Date: Tue, 28 May 2024 13:23:38 GMT

{
  "error": {
    "code": "FileOpenUserUnauthorized",
    "message": "You do not have permissions to open this file in the browser.",
    "innerError": {
      "code": "unauthorizedUncategorized",
      "message": "Required authentication information for the resource is either missing or invalid.",
      "innerError": {
        "code": "FileOpenUserUnauthorized",
        "message": "You do not have permissions to open this file in the browser."
      },
      "date": "2024-05-28T13:23:38",
      "request-id": "9c5e7705-5db3-497c-9b1c-cfd9dec53bb3",
      "client-request-id": "9c5e7705-5db3-497c-9b1c-cfd9dec53bb3"
    }
  }
}
shanshanzheng-dev commented 5 months ago

Hi @robertscl Thanks for the detailed information, we'll look into this issue and will report back if we have a suggestion for you. Thanks.

shanshanzheng-dev commented 4 months ago

Hi @robertscl Sorry for slow response. We are working on a mitigation but unfortunately have no timelines to share at this point. According to our investigation, this issue only happens for Workbooks stored in OneDrive Consumer platform. Please note Workbooks stored in OneDrive Consumer platform are not officially supported by Excel Graph as mentioned in the public documentation. We recommend you to use Excel workbooks stored in OneDrive for Business, SharePoint site or Group drive if you would like use Excel Graph with full support. We value your feedback:)

robertscl commented 4 months ago

Thank you, @shanshanzheng-dev ! I will dig further into the account types of the affected users and see if I can test various types myself.

That said, if you're able to share, I'd be curious if you have more context on any relevant recent changes. Many of the users currently experiencing this issue (89 at present) report that everything was working fine until some time in March (the exact time seems to vary) when they suddenly started seeing the 401 here, fully blocking their automations.

To be clear, I haven't yet confirmed if they are all on consumer accounts, but if they were, was there some recent change that would have broken Graph usage for those users?

Also assuming this is isolated to consumer accounts, will the mitigation strategies aim to restore the previous experience?

Thank you!

robertscl commented 4 months ago

Hi @shanshanzheng-dev,

Thanks again for your time and efforts on this.

We're still working to confirm whether all impacted users are on consumer OneDrive accounts or whether Business, Group, or SharePoint users are also affected. Interestingly, I've noticed that new consumer accounts do not (initially, at least) encounter this issue. If you have any insights there, I'd be curious to learn why that might be the case.

Regardless, I noticed a similar Issue here...

https://github.com/microsoftgraph/microsoft-graph-explorer-v4/issues/3014#issuecomment-2224958766

...where it sounds like a fix might be in the works, which will also restore affected accounts.

If I've misunderstood that thread, however, and that fix will not likely apply to what we've discussed here, please let me know so I can set accurate expectations with mutual users.

Thank you!

shanshanzheng-dev commented 3 months ago

Hi @robertscl Sorry for the late response. The issue in another thread should be same with the error you hit. The fix will also apply to your scenario. However, I cannot confirm the ETA because it is owned by our partner team. Please also note that although we aim to fix the issue this time, the Excel Graph API strategy on Consumer platform still keeps unchanged as before. It is not official supported for workbooks stored in OneDrive Consumer platform. We recommend you to use Excel workbooks stored in OneDrive for Business, SharePoint site or Group drive if you would like use Excel Graph with full support. Thanks.