Search code examples
onenoteonenote-api

OneNote Api - notebooks endpoint returns 403 for account owner


The API is returning a 403 (Forbidden) error when making a call from our iOS app with a work/business account to https://www.onenote.com/api/v1.0/me/notes/notebooks

The account being used is the administrator, the access token was properly generated using the ADAL library, the two-factor authentication is turned off and the app has the proper access in app permissions.

Is there any other reason for this error to happen?

Any pointers/help would be appreciated.


Solution

  • 403 typically happens when your app did not request the right permissions to get resources on our API.

    If this is a new integration, I would encourage you to use the Microsoft Graph API. It has generally more recently updated code samples, and almost all the functionality of the OneNote API is already in MS Graph.

    https://developer.microsoft.com/en-us/graph/docs/concepts/ios https://developer.microsoft.com/en-us/graph/graph-explorer

    If you give us the value of the X-CorrelationId in the response of your 403, we can help you look into this.


    EDIT

    Looked at your logs - this isn't the case. You have the right scopes. However, you are running into the problem below (take a look at your response payload and you will see an error code returned)

    https://blogs.msdn.microsoft.com/onenotedev/2016/09/11/onenote-api-calls-fail-with-a-large-number-of-items-in-a-sharepoint-document-library/