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?

2
  • I'm having this same problem. Did you ever resolve this issue? Commented Mar 1, 2015 at 12:57
  • Sorry, I didn't. Let me know if you find the solution. Commented Mar 9, 2015 at 21:54

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.
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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.