clientcredentials
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package clientcredentials implements the OAuth2.0 "client credentials" token flow,also known as "two-legged OAuth 2.0".
This should be used when the client is acting on its own behalf or when the clientis the resource owner. It may also be used when requesting access to protectedresources based on an authorization previously arranged with the authorizationserver.
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeConfig¶
type Config struct {// ClientID is the application's ID.ClientIDstring// ClientSecret is the application's secret.ClientSecretstring// TokenURL is the resource server's token endpoint// URL. This is a constant specific to each server.TokenURLstring// Scopes specifies optional requested permissions.Scopes []string// EndpointParams specifies additional parameters for requests to the token endpoint.EndpointParamsurl.Values// AuthStyle optionally specifies how the endpoint wants the// client ID & client secret sent. The zero value means to// auto-detect.AuthStyleoauth2.AuthStyle// contains filtered or unexported fields}Config describes a 2-legged OAuth2 flow, with both theclient application information and the server's endpoint URLs.
func (*Config)Client¶
Client returns an HTTP client using the provided token.The token will auto-refresh as necessary.
The provided context optionally controls which HTTP clientis returned. See theoauth2.HTTPClient variable.
The returnedhttp.Client and its Transport should not be modified.
func (*Config)Token¶
Token uses client credentials to retrieve a token.
The provided context optionally controls which HTTP client is used. See theoauth2.HTTPClient variable.
func (*Config)TokenSource¶
func (c *Config) TokenSource(ctxcontext.Context)oauth2.TokenSource
TokenSource returns aoauth2.TokenSource that returns t until t expires,automatically refreshing it as necessary using the provided context and theclient ID and client secret.
Most users will useConfig.Client instead.