Security Policy Errors

Fix SharePoint App-Only Authentication 401 Error on New Microsoft 365 Tenants

Aamir Naveed AkramAamir Naveed Akram Nov 13, 2026 869 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Connect to SharePoint Online PowerShell

Open Windows PowerShell as administrator and run Connect-SPOService -Url https://yourtenant-admin.sharepoint.com to sign in with a SharePoint administrator account.

2
Check the current tenant setting

Run Get-SPOTenant | Select LegacyAuthProtocolsEnabled and note whether the value is False.

3
Enable legacy authentication if required

Run Set-SPOTenant -LegacyAuthProtocolsEnabled $True and confirm the change when prompted.

4
Retest the SharePoint add-in

Wait a few minutes for the tenant setting to apply, then retry the app-only request that previously returned 401 Unauthorized.

Enable legacy authentication protocols for SharePoint Online
Security consideration: Enable this setting only if your add-in requires legacy app-only authentication; otherwise, use modern authentication methods and follow your tenant security policy.
Free Microsoft Office alternative

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. 1. Download WPS Office: Go to the official WPS Office website and click Download to get the free installer for your device.
  2. 2. Install and launch: Open the downloaded installer, follow the setup prompts, and launch WPS Office.
  3. 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. 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.
No Microsoft 365 tenant or SharePoint authentication changes required for daily Office document editingHigh compatibility with Microsoft Word, Excel, PowerPoint and PDF files (.docx, .xlsx, .pptx)Free, lightweight Office suite for Windows, macOS, Linux, Android, and iOSFamiliar ribbon interface makes migrating from Microsoft Office simpleBuilt-in PDF editing and cloud document sync
microsoft office alternative - wps office

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.