0
votes

I'm trying to integrate my app with OneDrive. I'm following this tutorial: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/?view=odsp-graph-online For oauth I'm using Azure AD v2.0 endpoint.

To get the access token, I'm calling https://login.microsoftonline.com/common/oauth2/v2.0/token and it successfully answers with some json:

{ token_type: 'Bearer',
  scope: 'onedrive.readwrite',
  expires_in: 3600,
  ext_expires_in: 3600,
  access_token: '...',
  refresh_token: '...' }

When using the access_token that I received to call https://graph.microsoft.com/v2.0/me/drive/root/delta, I get this response:

{
    "error": {
        "code": "InvalidAuthenticationToken",
        "message": "CompactToken parsing failed with error code: 8004920A",
        "innerError": {
            "request-id": "5eda75b0-c2d5-467f-a728-8006490c00b2",
            "date": "2019-08-19T15:56:10"
        }
    }
}

This error is pretty cryptic and for the life of me I can't work out why that token won't work with this endpoint. Can someone help?

1

1 Answers

0
votes

Never mind -- needed to set the scope as files.readwrite.all instead of onedrive.readwrite