Fix SharePoint App-Only Authentication 401 Error on New Microsoft 365 Tenants
Question details
A SharePoint add-in using a client ID and secret returns 401 Unauthorized on a newly created Microsoft 365 tenant, even though the same app works on an older tenant.
- Product
- SharePoint Online / Microsoft 365
- Device & OS
- not provided
- Scenario
- The user is configuring or testing a SharePoint add-in that uses app-only authentication with a client ID and secret on a new Microsoft 365 tenant.
- Observed behavior
- The SharePoint add-in returns 401 Unauthorized on the new tenant, while the same app works on an older tenant.
Verify that you have SharePoint Online admin or tenant admin access, and confirm that the add-in client ID and client secret are valid in the Microsoft Entra app registration before changing tenant authentication settings.
Enable legacy authentication protocols for SharePoint Online
Use this first for a SharePoint add-in that works in an older Microsoft 365 tenant but returns 401 Unauthorized in a newly created tenant.
New Microsoft 365 tenants may have legacy authentication protocols disabled by default. Some SharePoint add-ins that use app-only client ID/secret authentication rely on this protocol and fail with 401 Unauthorized until it is enabled.
Open Windows PowerShell as administrator and run Connect-SPOService -Url https://yourtenant-admin.sharepoint.com to sign in with a SharePoint administrator account.
Run Get-SPOTenant | Select LegacyAuthProtocolsEnabled and note whether the value is False.
Run Set-SPOTenant -LegacyAuthProtocolsEnabled $True and confirm the change when prompted.
Wait a few minutes for the tenant setting to apply, then retry the app-only request that previously returned 401 Unauthorized.

Validate the Microsoft Entra app registration and permissions
Use this if legacy authentication is already enabled or the app still returns 401 after the tenant setting is corrected.
Use WPS Office as a Free Microsoft Office Alternative for SharePoint Document Tasks
This 401 error is a Microsoft 365/SharePoint tenant configuration issue rather than a WPS Office issue. When you need to open, edit, and share Office documents without paying for Microsoft Office, WPS Office provides a free, lightweight suite with high compatibility and a familiar interface for a smooth move.
- 1. Download WPS Office: Go to the official WPS Office website and click Download to get the free installer for your device.
- 2. Install and launch: Open the downloaded installer, follow the setup prompts, and launch WPS Office.
- 3. Open or create Office documents: Open an existing .docx, .xlsx, or .pptx file, or create a new document in WPS Writer, Spreadsheets, or Presentation.
- 4. Edit and save in Microsoft-compatible formats: Use the familiar ribbon tools, then save the file in its original Microsoft Office format to preserve compatibility.

Frequently Asked Questions
Why does my SharePoint add-in return 401 only on a new Microsoft 365 tenant?
New Microsoft 365 tenants often have legacy authentication protocols disabled by default. A SharePoint add-in that uses app-only client ID/secret authentication may depend on legacy authentication, so it fails with 401 Unauthorized until you enable LegacyAuthProtocolsEnabled.
How do I check whether LegacyAuthProtocolsEnabled is enabled?
Connect to SharePoint Online PowerShell with Connect-SPOService -Url https://yourtenant-admin.sharepoint.com, run Get-SPOTenant | Select LegacyAuthProtocolsEnabled, and check whether the value is True or False.
What command enables legacy authentication for SharePoint Online?
Run Set-SPOTenant -LegacyAuthProtocolsEnabled $True in SharePoint Online PowerShell with tenant admin permissions. Wait a few minutes and retest the add-in.
Does WPS Office fix SharePoint app-only authentication errors?
No. WPS Office is an Office document suite and does not manage Microsoft 365 tenant authentication. SharePoint app-only authentication must be resolved in Microsoft 365 admin, Microsoft Entra, or SharePoint Online PowerShell.
Can WPS Office open files from SharePoint?
You can download Office documents from SharePoint and open or edit them in WPS Office, but WPS Office does not configure SharePoint add-in permissions or tenant authentication policies.




