4

I'm trying to make a call to the new Office 365 File REST APIs. (As explained here).

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 the access token I get an error.

------------------
RESOURCE HTTP GET:
------------------
URL: https://<OUR_DOMAIN>-my.sharepoint.com/personal/<user_domain>/_api/Files
HEADER: Authorization: Bearer <access token>

Response:

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

What can cause this issue?

Regent
  • 5,142
  • 3
  • 21
  • 35
Thushara
  • 91
  • 1
  • 6

2 Answers2

1

Not sure what steps you've tried to use to resolve this, so it's hard to help you out here. I've just finished writing up more detailed instructions on the steps to register an app to call OneDrive for Business. It's long and complicated right now, but we're working to make things better in the future.

You can check out the details of how to do auth here: https://dev.onedrive.com/auth/aad_oauth.htm

Make sure you aren't asking for too many permissions, since that will require your app to be authenticated by an admin instead of the end user. For most apps, you can just use the "My files" permission scopes which can be accepted by the user of your app directly.

If you post more information about what calls you're making, responses, and app configuration in AAD I might be able to help more.

Ryan Gregg
  • 2,015
  • 13
  • 16
  • Thanks for the details. I have managed to get it working now. I'm not very clear on how to add the scopes to the application manifest in Azure AD. – Thushara May 04 '15 at 22:43
1

You may have been using different resources.

Check whether the resource which you have used for getting access token is same as which you are requesting for getting files.

for example :

If the resource which you have mentioned while requesting access token be :: "https://tenant-my.sharepoint.com/"

Then you need to make request on the same resource for accessing files :: "https://tenant-my.sharepoint.com/_api/v2.0/drive/root/children"

The above request give list of root children.

  • tenant --> domain name which was registered to your organisation.

Follow this documentation for further accessing the api

npradeep357
  • 130
  • 11