fix: Implement a CredentialStore for auth#5741
Conversation
6dc7144 to
d6cfc64
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements a credential store for OAuth authentication in Goose, enabling persistent storage of OAuth tokens and automatic token refresh. The implementation integrates with the rmcp SDK's new CredentialStore trait.
Key changes:
- Implements
GooseCredentialStorethat uses the Config system for secure credential storage - Updates OAuth flow to use the credential store for loading and saving tokens
- Adds
_metafield to Tool schema for MCP protocol compliance
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/goose/src/oauth/persist.rs | Implements GooseCredentialStore with async trait methods for load/save/clear operations using the Config system |
| crates/goose/src/oauth/mod.rs | Integrates credential store into OAuth flow for token persistence and refresh |
| crates/goose/src/agents/extension_manager.rs | Adds meta: None field to Tool construction for schema compatibility |
| crates/goose/Cargo.toml | Updates async-trait to 0.1.89 |
| crates/goose-server/Cargo.toml | Updates async-trait to 0.1.89 |
| crates/goose-mcp/Cargo.toml | Updates async-trait to 0.1.89 |
| crates/goose-cli/Cargo.toml | Updates async-trait to 0.1.89 |
| crates/goose-bench/Cargo.toml | Updates async-trait to 0.1.89 |
| Cargo.toml | Updates rmcp to use git branch with credential store support |
| Cargo.lock | Lock file updates for dependency changes |
| ui/desktop/openapi.json | Adds _meta field to Tool schema |
| ui/desktop/src/api/types.gen.ts | Generates TypeScript types for new _meta field |
crates/goose/src/oauth/mod.rs
Outdated
| // Set the credential store on the manager we got from OAuthState | ||
| // The credentials were already saved during the exchange_code_for_token call |
There was a problem hiding this comment.
This comment is incorrect. Credentials haven't been saved yet because the OAuthState on line 79 was created without a credential store (second parameter is None). The old code explicitly called save_credentials() after handle_callback(), but that was removed. To fix this, pass Some(credential_store.clone()) as the second parameter to OAuthState::new() on line 79, or manually save credentials before this point. Otherwise, credentials obtained during the OAuth flow won't be persisted.
d6cfc64 to
2d395a2
Compare
2d395a2 to
eccc7f0
Compare
* origin/main: (60 commits) chore: incorporate LF feedback (#5787) docs: quick launcher (#5779) Bump auto scroll threshold (#5738) fix: add one-time cleanup for linux hermit locking issues (#5742) Don't show update tray icon if GOOSE_VERSION is set (#5750) fix: get win node path from registry (#5731) Handle spaces in extension names also (#5770) Remove empty settings card for Scheduling Engine (#5771) fix windows cli build (#5768) fix: Implement a CredentialStore for auth (#5741) blog post: How to Successfully Migrate Your App with an AI Agent (#5762) Simplify finding `goosed` (#5739) More time for goosed (#5746) Match lower case (#5763) scan recipe for security when saving recipe (#5747) feat: trying grok for live test (#5732) Platform Extension MOIM (Minus One Info Message) (#5027) docs: remove hackathon banner (#5756) Fix: Recipes respect the quiet flag (#5743) docs: update cli commands (#5744) ...
* 'main' of github.com:block/goose: (125 commits) Document Mistral AI provider (#5799) docs: Add Community Stars recipe script and txt file (#5776) chore: incorporate LF feedback (#5787) docs: quick launcher (#5779) Bump auto scroll threshold (#5738) fix: add one-time cleanup for linux hermit locking issues (#5742) Don't show update tray icon if GOOSE_VERSION is set (#5750) fix: get win node path from registry (#5731) Handle spaces in extension names also (#5770) Remove empty settings card for Scheduling Engine (#5771) fix windows cli build (#5768) fix: Implement a CredentialStore for auth (#5741) blog post: How to Successfully Migrate Your App with an AI Agent (#5762) Simplify finding `goosed` (#5739) More time for goosed (#5746) Match lower case (#5763) scan recipe for security when saving recipe (#5747) feat: trying grok for live test (#5732) Platform Extension MOIM (Minus One Info Message) (#5027) docs: remove hackathon banner (#5756) ...
Signed-off-by: Blair Allan <Blairallan@icloud.com>
Fixes #5259
More context in modelcontextprotocol/rust-sdk#542