MS365 connector auth broken: duplicate `prompt` parameter & random redirect URI port mismatch

Resolved 💬 3 comments Opened Apr 13, 2026 by pjakonis Closed May 24, 2026

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?

When trying to connect the MS365 connector in Cowork, two separate errors occur:

Bug 1: Duplicate prompt parameter in OAuth URL
The generated OAuth URL contains prompt twice — once as prompt=select_account near the start and again as prompt=consent at the end. Microsoft rejects this with:
AADSTS9000411: The request is not properly formatted. The parameter 'prompt' is duplicated.

Bug 2: Random redirect URI port not registered in Azure app
Each call to the authenticate tool spins up a new random localhost port (e.g. 51221, 55690, 56690). These ports are not registered as valid redirect URIs for the Azure app (08ad6f98-a4f8-4635-bb8d-f1a3044760f0), so Microsoft rejects the auth with:
AADSTS50011: The redirect URI 'http://localhost:56690/callback' specified in the request does not match the redirect URIs configured for the application.

The combination of these two bugs makes it completely impossible to connect MS365.

What Should Happen?

MS365 connector should authenticate successfully without duplicate prompt errors or redirect URI mismatches.

Error Messages/Logs

Error 1 (duplicate prompt):
AADSTS9000411: The request is not properly formatted. The parameter 'prompt' is duplicated.
Request Id: aa424e1f-135a-4573-96d0-e901fca23900
Timestamp: 2026-04-13T11:57:22Z

Error 2 (redirect URI mismatch):
AADSTS50011: The redirect URI 'http://localhost:56690/callback' specified in the request does not match the redirect URIs configured for the application '08ad6f98-a4f8-4635-bb8d-f1a3044760f0'.
Request Id: 8f2e4b46-4c14-44fa-8ee6-4e31b2282200
Timestamp: 2026-04-13T12:36:08Z

Example malformed URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?prompt=select_account&response_type=code&client_id=08ad6f98-a4f8-4635-bb8d-f1a3044760f0&...&prompt=consent

Steps to Reproduce

  1. Open Claude Code with Cowork
  2. Try to connect the MS365 connector
  3. Click the generated OAuth URL
  4. First error: AADSTS9000411 (duplicate prompt parameter)
  5. Re-trigger auth — get a new URL with a different random port
  6. Second error: AADSTS50011 (redirect URI port not registered in Azure app)
  7. Every subsequent attempt produces error 2 with a new random port

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Latest (claude --version not available in this session)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗