Skip to content

OAuth: InsecureTokenEndpointError renders as a retryable "Re-authenticate" banner that can never succeed #2280

Description

@cliffhall

Which client?

Web

The problem

The SDK's assertSecureTokenEndpoint throws InsecureTokenEndpointError when an OAuth token endpoint is plain http: on a host outside its loopback exemption (localhost / 127.0.0.1 / ::1). That string appears nowhere in the Inspector's source, so the error falls through to the generic auth-failure path and the UI renders a "Re-authentication required" banner with a Re-authenticate button.

That button cannot possibly work. The SDK special-cases this error to rethrow rather than fall through to a fresh /authorize redirect — it is a deliberate hard stop, not a transient auth failure. InsecureTokenEndpointError also does not extend OAuthError, precisely so it is not treated as retryable.

So the Inspector presents a terminal configuration error as a retryable auth error. The user clicks Re-authenticate, the same error is thrown again, and nothing in the UI ever says what is actually wrong or what to do about it.

Reported from the outside on modelcontextprotocol/typescript-sdk#2591, where it is the reason the underlying problem was hard to diagnose.

Expected behavior

Recognize the error and surface it as what it is: a configuration problem with a concrete cause and a concrete fix, and no Re-authenticate affordance.

The message should name the offending endpoint, say that OAuth token requests must use TLS, and point at the two things that actually resolve it — use https:, or make the endpoint genuinely loopback (localhost / 127.0.0.1 / ::1). Where a per-server Token URL override exists (#1906), that is the lever to mention.

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv2Issues and PRs for v2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions