logo
search
Exchange Connection Problems

How to Fix A1 NO AUTHENTICATE Failed for IMAP OAuth 2.0 in Exchange

Emma BrownEmma Brown Oct 21, 2026 868 views

Question details

The user needs to resolve an authentication failure when using OAuth 2.0 to connect to an IMAP mailbox via a Node.js application.

How to Fix A1 NO AUTHENTICATE Failed for IMAP OAuth 2.0
Product
Exchange Online IMAP
Device & OS
not provided
Scenario
Attempting to authenticate an IMAP connection using an Azure AD-generated OAuth token via the XOAUTH2 mechanism.
Observed behavior
The IMAP server rejects the authentication attempt with an "A1 NO AUTHENTICATE failed" error, despite the token successfully working for Microsoft Graph.
Before you start

Verify that modern authentication (OAuth 2.0) is enabled for your Microsoft 365 tenant and that IMAP access is explicitly turned on for the target mailbox.

Solution 1Recommended

Request Correct Exchange Online Scopes and Permissions

Ensure the application requests the correct scopes for Exchange Online instead of Microsoft Graph, as IMAP requires specific Exchange permissions.

A common cause for the NO AUTHENTICATE error is using an access token issued for Microsoft Graph instead of Exchange Online. IMAP authentication strictly requires an Exchange Online token.

For delegated authentication, you must request the specific Outlook IMAP permission and use the default scope.

1
Configure API permissions in Azure

Navigate to your application in the Azure Portal. Go to API permissions > Add a permission > APIs my organization uses. Search for 'Office 365 Exchange Online' and select it.

2
Add the IMAP permission

Select Delegated permissions and check 'IMAP.AccessAsUser.All'. Click Add permissions, and ensure you grant admin consent for the tenant.

3
Update your code scope

When requesting the token using MSAL in your code, ensure the scope array uses 'https://outlook.office365.com/.default' rather than a Microsoft Graph scope.

Request Correct Exchange Online Scopes and Permissions
Admin Consent Required: Exchange Online permissions usually require tenant administrator consent. Ensure the 'Status' column in Azure API Permissions shows a green checkmark.
Free Microsoft Office alternative

Manage Your Documents and Tasks Easily with WPS Office

While troubleshooting complex Exchange server and OAuth configurations often requires extensive development or admin effort, managing your daily productivity shouldn't be difficult. WPS Office provides a lightweight, highly compatible, and user-friendly alternative to Microsoft Office for all your document needs.

  1. 1. Download WPS Office: Visit the official WPS website to download the free installation package for your operating system.
  2. 2. Install the application: Run the downloaded installer and follow the simple on-screen instructions to complete the setup.
  3. 3. Open your files: Launch WPS Office and immediately open, edit, or save your Microsoft Office documents without format loss.
Completely free and lightweight office suite for Windows, Mac, and LinuxSeamlessly compatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar user interface ensuring zero learning curve for Office usersBuilt-in PDF editing and cloud synchronization
microsoft office alternative - wps office

Frequently Asked Questions

Why does my OAuth token work for Microsoft Graph but fail for IMAP?

Tokens generated for Microsoft Graph do not have the proper audience and claims for IMAP authentication. IMAP via Exchange Online requires a token specifically issued for the Exchange Online endpoint, utilizing scopes like 'https://outlook.office365.com/.default'.

How do I check if IMAP is enabled for a Microsoft 365 mailbox?

Log into the Microsoft 365 admin center, navigate to Active users, select the user in question, go to the Mail tab, and click 'Manage email apps'. Ensure that the IMAP checkbox is selected and save the changes.

Does IMAP support the Client Credentials flow (App-Only auth)?

Yes, but it requires additional configuration. You cannot just use Azure AD API permissions. You must register an Exchange Online Service Principal via PowerShell and explicitly grant it 'FullAccess' permissions to the targeted mailboxes.

What is the exact format required for the XOAUTH2 string?

The string must combine the user email and the bearer token using specific ASCII control characters. The unencoded format must be: 'user=mailbox@example.com\x01auth=Bearer YOUR_TOKEN\x01\x01'. It must then be base64-encoded before being sent.