How to Fix Exchange Online EWS Services.wsdl 401 Unauthorized Errors
Question details
The user is encountering 401 Unauthorized errors when attempting to access the Exchange Online EWS services.wsdl file.

- 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.
Ensure you have application administrator privileges in your Microsoft Entra ID (Azure AD) tenant and access to Exchange Online PowerShell to verify mailbox configurations.
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.
Navigate to the Microsoft Entra admin center, go to App registrations, and select 'New registration' to create an identity for your custom application.
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.
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.
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.

Verify EWS is Enabled for the Target Mailbox
If Exchange Web Services (EWS) is disabled at the organization or mailbox level, even properly authenticated OAuth requests will be rejected.
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. Download the installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install the application: Run the setup file and follow the straightforward on-screen instructions to complete the installation.
- 3. Start creating documents: Open WPS Office to immediately start working with your existing Microsoft Office files without any complex configurations.

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.




