User is authenticated but not connected.

Jan Sterba 0 Reputation points
2025-09-30T21:52:17.22+00:00

I have created an app registratio and configured it with required scopes to access emails over IMAP and SMTP.CleanShot 2025-09-30 at 23.49.38@2x

I tested the app and oauth flow with my outlook account and everything seems to work fine.

When a client uses the oauth flow to connect their azure managed office 365 account the generated token do not work when accessing their emails via IMAP.

We can connect and authenticate with IMAP but when we actually try to select a folder or fetch a list of folders we get: "User is authenticated but not connected."

How can we fix this? It seems like some configuration on the user tenant side more than on our side. Please advise.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-10-03T10:41:59.02+00:00

    Hi Jan,

    Thank you for posting your query on Microsoft Q&A.

    The error “User is authenticated but not connected” when accessing Office 365/Exchange mail over IMAP and OAuth often indicates an issue on the tenant or mailbox configuration. While your app registration and OAuth flow with Outlook accounts may be correct, connecting to Azure-managed Office 365 mailboxes can require tenant-level changes.

    Remediation Steps:

    1. IMAP Enablement
      • Ensure IMAP is enabled for the mailbox user on the target tenant. Tenant admins can check and enable this in Exchange Online admin center under mailbox features.
      1. API Permissions
        • Check your Azure app registration includes IMAP.AccessAsUser.All (Delegated) and the required SMTP.Send and Mail permissions, as shown in your screenshot.
          • Confirm the permissions have been granted consent (admin consent may be needed in some tenants, even if not indicated in portal).
          1. Tenant Consent/Approval
            • For delegated permissions, organizational users may need tenant admin consent. If users get “need admin approval” errors, the tenant admin should grant access to the required delegated scopes for your app.
            1. Conditional Access/Policies
              • Review any conditional access policies or security restrictions on the tenant, which may block access for IMAP or specific clients. Blocking legacy authentication can affect certain IMAP flows, even for OAuth.
              1. Session/Rate Limits
                • Office 365 IMAP implementation can lock out users if too many sessions are opened/closed rapidly. Wait a few minutes, disable and re-enable IMAP as a test, and avoid frequent reconnects during troubleshooting.
                1. Token Scope/Resource
                  1. Mailbox Licensing
                    • Verify the mailbox account being accessed is licensed. Unlicensed/shared mailboxes or service accounts may not authenticate successfully through OAuth IMAP.
                    1. Firewall/Network
                      • Confirm that IMAP (port 993) and SMTP traffic is allowed to Microsoft 365 endpoints from the client network.

    Please refer to:

    Please "Accept as Answer" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.