[BUG] M365 connector fails with AADSTS50011 in Cowork — localhost vs 127.0.0.1 redirect URI mismatch
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The M365 connector in Cowork mode fails to authenticate. Claude Desktop is generating http://localhost:62863/callback as the redirect URI, but the Azure app registration expects http://127.0.0.1/callback. This causes an AADSTS50011 error and the integration is completely broken.
OS: macOS
Claude Desktop version: 1.92552 (1dc8f7)
Account: M365 Business Basic
What Should Happen?
Expected behaviour:
Successful OAuth authorisation and M365 connection established.
Actual behaviour:
Browser returns: AADSTS50011 — The redirect URI http://localhost:62863/callback does not match the redirect URIs configured for the application. Expected: http://127.0.0.1/callback
Environment:
Error Messages/Logs
AADSTS50011: The redirect URI 'http://localhost:62863/callback' does not match the redirect URIs configured for the application. Ensure the redirect URI sent in the OIDC/OAuth request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.
Steps to Reproduce
Open Claude Desktop in Cowork mode
Attempt to connect the Microsoft 365 plugin
Click the authorisation link
Error AADSTS50011 is returned — redirect URI mismatch
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
1.92552 (1dc8f7)
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
This bug is in Claude Desktop Cowork mode, not Claude Code CLI. The M365 connector OAuth flow generates http://localhost with a dynamic port, which does not match the http://127.0.0.1/callback registered in Anthropic's Azure app. Confirmed with Anthropic support chat who acknowledged it is a known configuration issue requiring an engineering fix.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗