Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOAuth2HTTPClient ¶
func NewOAuth2HTTPClient(config OAuth2Config, baseTransport http.RoundTripper) (*http.Client, error)
NewOAuth2HTTPClient creates an http.Client that automatically handles OAuth2 client credentials authentication. It uses golang.org/x/oauth2/clientcredentials for token acquisition, caching, and automatic refresh. The baseTransport is used for both token endpoint calls and resource requests (e.g., for tracing). Pass nil to use http.DefaultTransport.
Types ¶
type OAuth2Config ¶
type OAuth2Config struct {
TokenEndpoint string `koanf:"tokenendpoint"`
ClientID string `koanf:"clientid"`
ClientSecret string `koanf:"clientsecret"`
Scopes []string `koanf:"scopes"`
}
OAuth2Config holds the configuration for OAuth2 client credentials authentication.
func (OAuth2Config) IsConfigured ¶
func (c OAuth2Config) IsConfigured() bool
IsConfigured returns true if the OAuth2 configuration has all required fields set.
Click to show internal directories.
Click to hide internal directories.