Skip to content

Conversation

@alexhancock
Copy link
Contributor

@alexhancock alexhancock commented Nov 14, 2025

Description

Adds the concept of a configurable CredentialStore for AuthorizationManager to use

The current implementation writes to credentials in memory. This change gives the flexibility for users of AuthorizationManager to provide a custom implementation that persists credentials (to keychain, disk, etc).

There is no change to default behavior, as a default implementation is provided which does the same as now (InMemoryCredentialStore)

Motivation

The motivation came from this bug report to goose that new refresh tokens sent from the server during token exchange were not being saved/used block/goose#5259

We store access tokens and refresh tokens via keyring, but we only did it on the initial auth and previously had no way to be informed of new refresh tokens received when rmcp exchanges tokens.

This allows for a provided CredentialStore to always load/save/clear token information from the storage mechanism of choice, and will fix block/goose#5259

@github-actions github-actions bot added T-dependencies Dependencies related changes T-config Configuration file changes T-core Core library changes T-transport Transport layer changes labels Nov 14, 2025
@alexhancock alexhancock force-pushed the alexhancock/credential-store branch from aec2b30 to adb0f89 Compare November 14, 2025 18:10
@alexhancock alexhancock changed the title feat: credential store trait feat(auth): CredentialStore trait Nov 14, 2025
@alexhancock alexhancock force-pushed the alexhancock/credential-store branch 2 times, most recently from 36ef601 to c3e6d71 Compare November 14, 2025 18:18
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
async-trait = "0.1.89"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how big a concern it is to have this, but if you want to avoid adding this dependency you can have the trait return Futures

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I often use this dependency and I am planning to introduce it in the future to make the code more concise. Do you want to change other implementations to this dependency implementation as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can use it more - it seems nice

@alexhancock alexhancock force-pushed the alexhancock/credential-store branch from c3e6d71 to a9b1962 Compare November 14, 2025 20:24
jamadeo
jamadeo previously approved these changes Nov 14, 2025
jokemanfire
jokemanfire previously approved these changes Nov 17, 2025
Copy link
Collaborator

@jokemanfire jokemanfire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexhancock alexhancock dismissed stale reviews from jokemanfire and jamadeo via 479c0ce November 17, 2025 14:31
@alexhancock alexhancock force-pushed the alexhancock/credential-store branch from a9b1962 to 479c0ce Compare November 17, 2025 14:31
@alexhancock alexhancock merged commit 31be9b2 into main Nov 17, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-config Configuration file changes T-core Core library changes T-dependencies Dependencies related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP OAuth refresh_token not used correctly

4 participants