Documentation
¶
Index ¶
Constants ¶
const ( // ProtocolScheme is the custom URI scheme for OAuth callbacks. ProtocolScheme = "wmcp" // ProtocolCallbackURL is the redirect URI to register with Webex. ProtocolCallbackURL = ProtocolScheme + "://oauth-callback" )
const ( // DefaultScopes covers the APIs this plugin uses. // Override with WEBEX_SCOPES env var, or use "spark:all" for full access. DefaultScopes = "" /* 156-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func CallbackFilePath ¶
CallbackFilePath returns the path where the callback handler writes the auth code.
func HandleCallbackURL ¶
HandleCallbackURL parses a wmcp:// URL from the OS and writes the callback file. Called by `webex-mcp --oauth-callback <url>`.
func RegisterProtocol ¶
RegisterProtocol registers the wmcp:// custom URI scheme with the OS so that OAuth callbacks open the webex-mcp binary.
func WriteCallbackFile ¶
WriteCallbackFile is called by the --oauth-callback handler to deliver the authorization code to the waiting Authorize() call via the filesystem.
Types ¶
type OAuthConfig ¶
type OAuthConfig struct {
ClientID string
ClientSecret string
RedirectURI string // Optional; defaults to wmcp://oauth-callback.
Scopes string // Optional; defaults to DefaultScopes.
}
OAuthConfig holds the OAuth integration credentials.
type OAuthProvider ¶
type OAuthProvider struct {
// contains filtered or unexported fields
}
OAuthProvider manages OAuth tokens with automatic refresh.
func NewOAuthProvider ¶
func NewOAuthProvider(config OAuthConfig) (*OAuthProvider, error)
NewOAuthProvider creates a provider that handles the full OAuth lifecycle. It loads any previously stored tokens automatically.
func (*OAuthProvider) Authorize ¶
func (p *OAuthProvider) Authorize(ctx context.Context) error
Authorize runs the interactive OAuth authorization code flow with PKCE. It opens the browser, then polls for the callback file written by the wmcp:// protocol handler. No HTTP listener is used.
func (*OAuthProvider) NeedsAuth ¶
func (p *OAuthProvider) NeedsAuth() bool
NeedsAuth returns true if the user must go through the browser OAuth flow.
func (*OAuthProvider) Token ¶
func (p *OAuthProvider) Token() (string, error)
Token returns a valid access token, refreshing if needed.
type StaticProvider ¶
type StaticProvider struct {
// contains filtered or unexported fields
}
StaticProvider wraps a fixed Personal Access Token.
func NewStaticProvider ¶
func NewStaticProvider(token string) *StaticProvider
NewStaticProvider creates a provider that always returns the same token.
func (*StaticProvider) Token ¶
func (p *StaticProvider) Token() (string, error)
Token returns the static access token.
type StoredTokens ¶
type StoredTokens struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
AccessTokenExpiresAt time.Time `json:"access_token_expires_at"`
RefreshTokenExpiresAt time.Time `json:"refresh_token_expires_at"`
}
StoredTokens holds persisted OAuth tokens.
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore handles persistent token storage.
func NewTokenStore ¶
func NewTokenStore() (*TokenStore, error)
NewTokenStore creates a store at the user's config directory.
func (*TokenStore) Delete ¶
func (s *TokenStore) Delete() error
Delete removes the stored token file.
func (*TokenStore) Load ¶
func (s *TokenStore) Load() (*StoredTokens, error)
Load reads stored tokens from disk.
func (*TokenStore) Save ¶
func (s *TokenStore) Save(tokens *StoredTokens) error
Save writes tokens to disk with restricted permissions.