I'm trying to access all my files in my drive via the endpoint
/me/drive/root/children
However it returns 0 children even though the following observations happen:
Calling /me/drive/root
returns:
","folder":{"childCount":3},"root":{},"size":28413,"specialFolder":{"name":"documents"}}
More interestingly, doing the API call from the Graph Explorer:
https://graph.microsoft.io/en-us/graph-explorer does show the 3 files that I have when using me/drive/root/children
.
The graph explorer matches perfectly the API call when using /me/drive/root
, but not /me/drive/root/children
.
What is happening?
EDIT:
Following Brad suggestion I decoded the token with https://jwt.io/ and the parameters scp reads:
scp": "Mail.Send User.Read",
Second edit:
I removed all the app permissions from apps.dev.microsoft.com and I still have the same observations. It's looks like the permissions I set there have no effect.
The code above follows the example found at:
https://dev.office.com/code-samples-detail/5989
As it turns out, the whole confusing was coming from here:
microsoft = oauth.remote_app(
'microsoft',
consumer_key=client_id,
consumer_secret=client_secret,
request_token_params={'scope': 'User.Read Mail.Send Files.Read Files.ReadWrite'},
base_url='https://graph.microsoft.com/v1.0/',
request_token_url=None,
access_token_method='POST',
access_token_url='https://login.microsoftonline.com/common/oauth2/v2.0/token',
authorize_url='https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
)
I did not have the right scopes declared in request_token_params
. So even if the app has the permissions, without the scopes declared there you cannot access the sheets.