The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Based on the information provided, I understand that you are encountering Error 3000003 - invalid_client while integrating the SharePoint File Picker v8.
Generally, this error occurs because your Azure AD (Entra ID) application fails to authenticate properly during the standalone authentication flow initiated by the File Picker. Even if your main application logs in successfully via MSAL, the File Picker runs inside an isolated iframe, which triggers its own separate authentication loop. Because the picker strictly validates the token's audience and scope, any mismatch or caching issue during token acquisition will cause this failure.
To resolve this issue, please review the technical breakdown and configuration checklists below:
- Incorrect Audience: The File Picker explicitly expects the token's audience to be the target SharePoint resource URL (e.g., https://contoso.sharepoint.com or the user's personal OneDrive site
https://{tenant}-my.sharepoint.com). It does not accept Microsoft Graph tokens (https://graph.microsoft.com). - Static Scope Logic: The picker sends a
resourceproperty inside itsauthenticatecommand containing the exact SharePoint site URL it needs. If your application logic does not dynamically build the scope using this variable, MSAL might return a cached Graph token or a token acquired for a completely different SharePoint site. - MSAL Cache Behavior:
acquireTokenSilentcan occasionally fetch an incorrect token from the local cache, especially if a user navigates frequently between OneDrive and various SharePoint sites. Furthermore, standard token expiration (~1 hour) will trigger this error if a silent refresh is not handled properly.
To ensure a stable authentication handshake with the File Picker v8, please apply the following adjustments to your code and Azure configurations:
- Always read the
resourceproperty sent by the picker in theauthenticatecommand and construct your request scope dynamically using the format:${resource}/.default. - Set Active Account: Call
msalInstance.setActiveAccount(...)immediately following a successful interactive login so MSAL consistently tracks the correct user context. - Proactive Token Refresh: Handle token expiration cleanly by executing
acquireTokenSilentright before launching the picker or immediately when theauthenticatecommand event arrives. - Personal Account Handling (MSA): If your application needs to support personal OneDrive accounts, note that you will need a separate authentication flow using the
consumersauthority endpoint and theOneDrive.ReadWritescope.
Additionally, please ensure that your App Registration has been granted and consented to the minimum required delegated permissions:
- SharePoint:
SharePoint.MyFiles.Read+SharePoint.AllSites.Read - Or the Graph equivalents:
Files.Read.All+Sites.Read.All
Please give these adjustments a try and let me know if you need further clarification on handling the picker's authentication events!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.