type Config struct {
// ClientID is the application's ID.
ClientID string
// ClientSecret is the application's secret.
ClientSecret string
// TokenURL is the resource server's token endpoint
// URL. This is a constant specific to each server.
TokenURL string
// Scope specifies optional requested permissions.
Scopes []string
}
Client Credentials Config describes a 2-legged OAuth2 flow, with both the client application information and the server's endpoint URLs.
func (c *Config) Client(ctx context.Context) *http.Client
Client returns an HTTP client using the provided token. The token will auto-refresh as necessary. The underlying HTTP transport will be obtained using the provided context. The returned client and its Transport should not be modified.
func (c *Config) Token(ctx context.Context) (*oauth2.Token, error)
Token uses client credentials to retrieve a token. The HTTP client to use is derived from the context. If nil, http.DefaultClient is used.
func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource
TokenSource returns a TokenSource that returns t until t expires, automatically refreshing it as necessary using the provided context and the client ID and client secret.
Most users will use Config.Client instead.