logo
search
Exchange Connection Problems

How to Fix Exchange Online EWS Services.wsdl 401 Unauthorized Errors

Khadija KhanKhadija Khan Oct 21, 2026 868 views

Question details

The user is encountering 401 Unauthorized errors when attempting to access the Exchange Online EWS services.wsdl file.

How to Fix Exchange Online EWS Services.wsdl 401 Unauthorized Errors
Product
Microsoft Exchange Online
Device & OS
not provided
Scenario
Accessing Exchange Web Services (EWS) via a custom application after Microsoft disabled Basic Authentication.
Observed behavior
The server responds with a 401 Unauthorized error and prompts for credentials repeatedly instead of providing access to the services.wsdl file.
Before you start

Ensure you have application administrator privileges in your Microsoft Entra ID (Azure AD) tenant and access to Exchange Online PowerShell to verify mailbox configurations.

Solution 1Recommended

Configure OAuth 2.0 for Your EWS Application

Microsoft has deprecated Basic Authentication for Exchange Online. You must transition your application to use Modern Authentication (OAuth 2.0) to access EWS services successfully.

Since Basic Authentication is permanently disabled in Exchange Online, applications relying on simple username and password inputs will fail with a 401 error. By registering your application in Microsoft Entra ID (Azure AD), you can securely acquire access tokens for EWS requests.

1
Register the application in Microsoft Entra ID

Navigate to the Microsoft Entra admin center, go to App registrations, and select 'New registration' to create an identity for your custom application.

2
Grant API permissions

Under 'API permissions', add a permission for 'Exchange' and select 'EWS.AccessAsUser.All' for delegated permissions. Ensure you grant admin consent if required by your tenant policies.

3
Update your application code to acquire tokens

Modify your application's authentication flow to request an OAuth 2.0 access token from the Microsoft identity platform using standard OAuth libraries or REST requests.

4
Pass the token in the HTTP header

When making the request to the services.wsdl URL, include the acquired token in the HTTP Authorization header as 'Bearer {your_access_token}' instead of providing Basic credentials.

Configure OAuth 2.0 for Your EWS Application
C++ Compatibility: Although Microsoft provides MSAL primarily for C# and other managed languages, you can implement OAuth 2.0 in C++ by utilizing standard HTTP libraries to execute the OAuth 2.0 token endpoints manually.
Free Microsoft Office alternative

Looking for a Hassle-Free Office Suite? Try WPS Office

While resolving server-side authentication issues in Microsoft environments can be highly technical, managing your daily documents shouldn't be. WPS Office provides a free, lightweight, and incredibly intuitive alternative to Microsoft Office for your everyday productivity.

  1. 1. Download the installer: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install the application: Run the setup file and follow the straightforward on-screen instructions to complete the installation.
  3. 3. Start creating documents: Open WPS Office to immediately start working with your existing Microsoft Office files without any complex configurations.
Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Lightweight application that uses minimal system resources.Built-in PDF editor for seamless document conversion and editing.Familiar user interface ensuring a smooth migration without a steep learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why am I suddenly getting 401 Unauthorized errors in my EWS application?

Microsoft has permanently disabled Basic Authentication for Exchange Online to improve security. Applications still using basic username and password credentials will now receive a 401 Unauthorized error and must be updated to use OAuth 2.0.

Can I re-enable Basic Authentication for Exchange Online?

No, Basic Authentication for EWS in Exchange Online has been deprecated and permanently disabled by Microsoft. You must migrate your application's authentication flow to Modern Authentication (OAuth 2.0).

How do I request the services.wsdl file using OAuth 2.0?

Instead of passing a username and password, you must acquire an OAuth 2.0 access token from Microsoft Entra ID (Azure AD) and include it in your HTTP request headers as 'Authorization: Bearer {token}' when accessing the services.wsdl endpoint.

Are C++ applications supported for OAuth 2.0 with Exchange Online?

Yes. OAuth 2.0 is an industry-standard REST protocol. While Microsoft provides libraries like MSAL for C#, you can use any C++ HTTP library that supports standard REST APIs to request a token and authenticate your EWS requests.