Reputation: 93
When I run the following code I receive exception (message: Must be authenticated to use '/drive' syntax) on invoking the request:
private async Task<Item> GetRoot()
{
var driveClient =
await OneDriveClientExtensions.GetAuthenticatedUniversalClient(
new string[] { "files.readwrite", "offline_access" }
);
if (!driveClient.IsAuthenticated) return null;
var itemRequest = driveClient.Drive.Root.Request();
return await itemRequest.GetAsync();
}
I tried to debug using override for IHttpProvider
and I see GET request is sent to https://api.onedrive.com/v1.0/drive/root with two headers X-RequestStats
and Authorization
with correct token.
I also checked consent for the app in https://account.live.com/consent/Manage and I see "Access OneDrive files" and "Access your info anytime" permissions.
I probably miss something basic. Please advise.
Thanks
Upvotes: 2
Views: 526
Reputation: 4923
I also checked consent for the app in https://account.live.com/consent/Manage and I see "Access OneDrive files" and "Access your info anytime" permissions.
This is a documentation issue, the files.* scopes are not properly registered for OneDrive Personal.
The document has been reverted to previous version, please use the onedrive.readwrite scope to ensure your app works as expected.
See this issue in onedrive-api-docs repository
It appears that the files.* scopes are not properly registered for OneDrive Personal. I've reverted the documentation to indicate you should use the onedrive.* scopes for OneDrive Personal. Please use the onedrive.readwrite scope to ensure your app works as expected.
Upvotes: 2