Fix OneDrive for Business API Access Denied Errors
Question details
Identify the app registration, permissions, consent, and authentication settings needed to access OneDrive for Business through an API.

- Product
- OneDrive for Business API and Microsoft Entra ID
- Device & OS
- not provided
- Scenario
- An application registered in Azure AD completes OAuth authentication and then calls the Office 365 discovery API.
- Observed behavior
- The discovery API returns an Access Denied error after authentication.
Identify the tenant, account type, API endpoint, OAuth flow, and exact error response used by the application. Check whether the application uses the legacy Office 365 discovery API or Microsoft Graph.
Check App Registration, Permissions, and Tenant Consent
Use this approach to verify that the registered app and access token are authorized for the API being called.
In the Microsoft Entra admin center, open Identity > Applications > App registrations, select the application, and check its supported account types and tenant configuration.
Open API permissions in the app registration and confirm that the permissions match the target API and authentication flow. For Microsoft Graph, a delegated flow might use Files.Read; an app-only flow requires an appropriate application permission, such as Files.Read.All.
On the API permissions page, check the consent status. If admin consent is required, ask a tenant administrator to select Grant admin consent after reviewing the requested permissions.
Inspect the token claims and confirm that the audience identifies the API being called and that the delegated scopes or application roles include the required permissions. Never share the token when requesting help.
Acquire a new access token after any permission or consent changes, then retry the API request and record its HTTP status, error code, and correlation ID if it still fails.

Evaluate Migrating From the Legacy Discovery API to Microsoft Graph
Use Microsoft Graph for new OneDrive integrations or when the legacy discovery endpoint is no longer supported for your scenario.
Ask Microsoft Developer Support for Help
Use this option if the error persists after checking the registration, consent, and token configuration.
Work With Office Files in WPS Office
WPS Office is a free, lightweight alternative for editing documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format support make it easy to move existing files, though it does not fix OneDrive API authorization errors.

Frequently Asked Questions
Why does the API deny access after OAuth sign-in succeeds?
Successful sign-in does not guarantee authorization for an API. Check the app's API permissions, tenant consent, token audience, and delegated scopes or application roles in Microsoft Entra ID.
Where do I grant consent for OneDrive API permissions?
In the Microsoft Entra admin center, open Identity > Applications > App registrations, select the app, and open API permissions. A tenant administrator can grant admin consent there when required.
Can I use a Microsoft Graph token with the Office 365 discovery API?
Not automatically. The access token's audience must match the API being called, and the app must have the permissions required by that API.
Which Microsoft Graph endpoint should I use for a user's OneDrive?
For a delegated request by a signed-in user, use GET /me/drive. For an app-only request, use an endpoint such as GET /users/{id}/drive with appropriate application permissions and admin consent.
What should I include in a developer support request?
Include the endpoint, HTTP status, error code, correlation ID, tenant type, authentication flow, and permission configuration. Do not post access tokens, client secrets, or other sensitive information.




