crucifix94
crucifix94

Reputation: 203

Getting invalidRequest error while getting default drive for few users using client_credential token in msgraph api

I am using /delta APIs to get files for the users of my tenant domain using client_credential access token. For some of the users I get

{
    "error": {
        "code": "invalidRequest",
        "message": "Call was made to the default drive, which is not supported for apponly tokens.",
        "innerError": {
            "request-id": "xxxxx-xxx-xxxxx-xxx-xxxx-xxx",
            "date": "201x-0x-xxTxx:19:46"
        }
    }
}

on hitting /users/{user-id}/drive or /users/{user-id}/drive/root/delta

I checked that the user have a oneDrive license and verified it from provisionedPlans property of the /users api

"provisionedPlans": [
        {
            "capabilityStatus": "Enabled",
            "provisioningStatus": "Success",
            "service": "SharePoint"
        },
        {
            "capabilityStatus": "Enabled",
            "provisioningStatus": "Success",
            "service": "SharePoint"
        },
        {
            "capabilityStatus": "Enabled",
            "provisioningStatus": "Success",
            "service": "exchange"
        },
        {
            "capabilityStatus": "Enabled",
            "provisioningStatus": "Success",
            "service": "MicrosoftCommunicationsOnline"
        }
    ],

It is working fine for many of the other users with same licenses/plans

So, what could be the reason for the error for just some users ?

Upvotes: 1

Views: 764

Answers (1)

BDarley
BDarley

Reputation: 1275

I was randomly getting the same results for a newly provisioned account. Every request made returned "Call was made to the default drive, which is not supported for apponly tokens"

Other users, even newly provisioned accounts returned the requested OneDrive details for the indicated account.

Eventually the error cleared out and the troubled account started to return the expected results, e.g. 200 OK

So I guess it's just a waiting game... That is if the issue stems from a newly provisioned account.

Upvotes: 1

Related Questions