Authentication · troubleshooting record
MCP OAuth flow fails at the callback
The client opened an authorization page but could not complete the redirect or exchange. Causes include a mismatched redirect URI, a blocked localhost callback, an expired authorization code, or a provider that requires a different OAuth client registration.
Symptoms
- The browser shows a redirect error after approving the app.
- The client remains disconnected after an apparently successful login.
- The provider console logs an invalid redirect URI or code exchange failure.
Confirmed causes
These causes have a documented basis. They may not be the cause of your specific failure.
The redirect URI registered with the provider does not exactly match the client's callback
OAuth providers require exact redirect URI matching, including scheme, host, port, and path.
The client cannot receive the localhost callback
Desktop clients commonly use a loopback callback; a firewall, another process, or a container boundary can prevent it.
The authorization code expired or was reused
OAuth authorization codes are short-lived and single-use.
Possible causes
- The browser session is logged into a different provider account than intended.
- The MCP server was updated to a new OAuth client or redirect path.
- A proxy modifies the callback URL.
- The provider requires PKCE and the client version does not implement it correctly.
What still needs verification
- The redirect URI shown in the provider's app settings versus the client's actual callback.
- Whether the callback port is reachable locally.
- The provider's current OAuth requirements for MCP clients.
Affected environments
Fixes
Match the redirect and client registration
- Compare the provider's registered redirect URI with the client's documented callback.
- Update the provider app configuration rather than guessing the callback path.
- Revoke stale grants and restart the login flow.
Remove local callback blockers
- Close other processes that may occupy the callback port.
- Allow the browser and client through the local firewall.
- If the client runs in a container, ensure the callback can reach the host browser.
Verify the fix
- The provider logs a successful code exchange.
- The client shows the remote server as connected.
- A read-only tool call succeeds with the granted scopes.
Paste the configuration into the Config Doctor. It runs in your browser, never uploads the file, and can show structural issues and safe fixes.
Why we believe this
- code.claude.com/docs/en/mcpOfficial documentation · checked Oct 23, 2026 · documented
Claude Code documents OAuth and remote server authentication behavior for MCP.
- modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-httpOfficial documentation · checked Oct 23, 2026 · documented
The specification defines the single Streamable HTTP endpoint, protocol headers, Accept requirements, and Origin validation.