Unable to access files in onedrive, getting FileOpenUserUnauthorized

onmicrosoft 1 Reputation point
2021-03-12T10:52:33.68+00:00

Hey there, I am trying to use the graph api, connecting via authorization code oauth. I have an application in Azure that has all the permissions enabled (not recommended but I did these for debug purposes).

The problem is that when I try to retrieve a file via the api (get a workbook for example) I get the following error:

{
"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": "2021-03-12T10:48:17",
"request-id": "dff28442-d497-4956-bcdf-526b31e669a8",
"client-request-id": "dff28442-d497-4956-bcdf-526b31e669a8"
}
}
}

The request is:

GET https://graph.microsoft.com/v1.0/me/drive/items/MY_WORKBOOK_ID/workbook/worksheets
Authorization Bearer xxxx

I am mentioning that ALL THE PERMISSIONS ARE GRANTED IN AZURE, and I am able to authenticate successfully as other operations like, list files in my drive, are working fine via the api.

Any thoughts of what I should check.

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,271 Reputation points Microsoft Employee
    2021-03-15T01:54:09.827+00:00

    Above error is telling that you don't have necessary permission to access the onedrive. Validate the token in https://jwt.ms and make sure the logged on user has necessary permissions in it or not. If not, make sure to add them in your AAD/Graph permissions and then give a try, then you will see that you can access the resources.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.