0
votes

Please let me know what is the authentication method we should use when working with OneDrive REST APIs. Is it AZURE AD using the URL https://login.windows.net/common/oauth2/authorize? Or the https://login.live.com/oauth20_authorize.srf?

I'm trying to make a simple call to the new OneDrive REST API (I'm using Azure AD, but not sure if this is the correct Authentication method). I'm using Postman rest client to send the request. I have registered my application in Azure AD and given it full permissions to 'Office 365 SharePoint Online'. I can successfully get an authorization token using the clientId generated in Azure AD. However when I attempt to list files using following request using the access token I get the following error. Could you please let me know what could be the issue?


RESOURCE HTTP GET:

URL: https://-my.sharepoint.com/personal//_api/Files HEADER: Authorization: Bearer

Response:

3001000;reason="There has been an error authenticating the request.";category="invalid_client"

2

2 Answers

2
votes

IF you refer the public free version of OneDrive, then you should take a look at OneDrives API Documentation. Which uses Live SDK.

If you are using the OneDrive for Business, then you should use the SharePoint 2013 APIs. For SharePoint online this Question (its answer) on SharePoint StackExchange might be helpful. OR if you look for the new-and-in-preview Office365, you might find this page interesting.

A blog post with full walkthrough and code how to authenticate to SharePoint Online with Azure ACS.

0
votes

Check out the [new][1] v1.0 O365 APIs that describe the OneDrive Business and other O365 service APIs, including authentication.