Overview
TheSecretsClient lets a room manage participant-scoped OAuth credentials and secrets:
- Request OAuth access tokens (interactive flow) with PKCE by default.
- Fetch a offline (saved) tokens for a participant if one already exists
- List and delete stored secrets for the current room.
Availability: Python SDK and CLI today. Other SDKs may add helpers later.
CLI Note: Room-scoped secrets and OAuth actions are undermeshagent oauth2. For project wide or image-pull secrets, usemeshagent secret.
API Methods
list_user_secrets
- Description: List secrets saved to the current room.
- Parameters: None.
- Returns:
list[SecretInfo](id,type,name,delegated_to| None)
delete_user_secret
- Description: Delete a stored secret by ID.
- Parameters:
id: str— secret IDdelegated_to: str | None- who the secret is delegated to
- Returns:
None
request_oauth_token
- Description: Run an OAuth flow and return an access token after the target participant grants consent. If a valid credential already exists, the server may refresh and return it without prompting the user to sign-in.
- Parameters:
oauth:OAuthClientConfig(client_id, authorization_endpoint, token_endpoint, client_secret?, scopes?, no_pkce?)connector:ConnectorRef(optional; use a configured connector instead of raw OAuth settings)from_participant_id: str — participant who must approveredirect_uri: strdelegate_to: str | None — save for another participanttimeout: int (seconds; default 300)
- Returns:
str(access token) - Notes: Checked against SecretsGrant permissions. PKCE is used unless
no_pkceis set on the OAuth config.
get_offline_oauth_token
- Description: Retrieve a previously saved token for a participant—no prompt shown. Returns
Noneif there isn’t one. This is useful for email based agents that cannot display an interactive UI to the user. - Parameters:
oauth:OAuthClientConfig(same fields as above) orconnector:ConnectorRef(optional)delegated_to: str | None — participant the token belongs todelegated_by: str | None — who granted it
- Returns:
str | None(access token or None)
provide_oauth_authorization
- Description: Approve an OAuth prompt by sending the authorization code for a pending request. Use this only if your app shows the user the oauth approval UI (after
request_oauth_tokenis called). For example, an agent might callrequest_oauth_tokeninside a tool, if so then the UI must callprovide_oauth_authorizationto… - Parameters:
request_id: str — ID of the pending request you’re answeringcode: str — authorization code returned by the provider after the user authenticates
- Returns:
None
reject_oauth_authorization
- Description: Deny an OAuth prompt when the user cancels or an error occurs in your approval UI.
- Parameters:
request_id: str — ID of the pending request you’re answeringerror: str — short reason (e.g., “user_cancelled”, “invalid_state”)
- Returns:
None