Use GetValidTokens.
Gets valid tokens for a connection, refreshing if needed.
MCP Server Connection ID
Client registration for token refresh
Token endpoint URL
User context
Valid token set
Use HandleRefreshFailure.
Handles a refresh failure by determining if re-authorization is needed.
The error message from the failed refresh
Object indicating whether re-authorization is required
Checks if a token set is valid (not expired or expiring soon).
Token set to check
true if valid
Use IsTokenValid.
Checks if stored tokens are valid (not expired or expiring soon).
MCP Server Connection ID
User context
true if tokens are valid
Use LoadTokens.
Loads tokens for a connection.
MCP Server Connection ID
User context
Token set or null if not found
Use RefreshTokens.
Refreshes tokens using the refresh token.
Uses concurrent refresh protection to prevent multiple simultaneous refresh operations for the same connection.
MCP Server Connection ID
Current token set with refresh token
Client registration for authentication
Token endpoint URL
User context
Refresh result
Optionalprovider: IMetadataProviderUse RevokeCredentials.
Revokes stored credentials for a connection.
Deletes both the OAuthToken metadata and the associated credential.
MCP Server Connection ID
User context
Optionalprovider: IMetadataProviderOptionalprovider: IMetadataProviderUse StoreTokens.
Stores new OAuth tokens for a connection.
Creates or updates a credential via CredentialEngine, then stores metadata in the OAuthToken table.
MCP Server Connection ID
Token set to store
User context
Optionalprovider: IMetadataProvider
Manages OAuth token storage, validation, and refresh.
Features:
Example