Skip to content

[Client] Key stored OAuth tokens by client, not only by issuer and resource #719

Closed

Description

@chr-hertel

CredentialStorageInterface keys tokens by issuer and resource only, so two OAuth configurations sharing one storage pick up each other's tokens - a service account with setScopes('mcp:read') and a user-facing app with broader scopes, or two clients with different client IDs at the same authorization server.

#669 keeps a service account from reusing a stored token beyond its configured scopes, but that only covers the scope side. A token issued to another client, or a refresh token that only another client can spend, is still taken over as it is.

Options I see:

a) add the client ID to getToken() / saveToken()
b) compose the key in OAuthAuthenticator from client ID and grant, and keep the interface as it is
c) store the client ID on AccessToken and refuse a token of another client on read

The interface is new in 0.10.0, so changing it before that release is no BC break. I'd go with a) - WDYT?

Activity

  1. added
    ClientIssues & PRs related to the Client component
    on Nov 10, 2026
  2. self-assigned this
    on Nov 10, 2026
  3. added
    authIssues and PRs related to Authentication / OAuth
    on Nov 10, 2026
  4. added a commit that references this issue on Nov 10, 2026
    f236a9f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ClientIssues & PRs related to the Client componentauthIssues and PRs related to Authentication / OAuth

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions