Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthTransport ¶ added in v4.61.0
func NewAuthTransport(ts oauth2.TokenSource) http.RoundTripper
NewAuthTransport creates a new TokenAuthTransport with the provided TokenSource
func NewTokenSource ¶
func NewTokenSource(opts ...TokenSourceOption) (oauth2.TokenSource, error)
func TokenAuthEditor ¶ added in v4.61.0
TokenAuthEditor returns a custom RequestEditorFn to inject the OAuth2 token
Types ¶
type RewriterFunc ¶ added in v4.61.0
RewriterFunc is a function that can be used to rewrite the request before it is sent
type TokenAuthTransport ¶ added in v4.61.0
type TokenAuthTransport struct { TokenSource oauth2.TokenSource // required BaseTransport http.RoundTripper Rewriter RewriterFunc }
TokenAuthTransport is a custom http.RoundTripper to inject the OAuth2 token
type TokenSourceOption ¶
type TokenSourceOption func(source *tokenSource)
func WithAccessToken ¶
func WithAccessToken(token, tokenType string, expiry time.Time) TokenSourceOption
WithAccessToken sets the access token, token type and expiry time for the token source. Deprecated: Use WithToken instead.
func WithDefaultContext ¶
func WithDefaultContext(ctx context.Context) TokenSourceOption
WithDefaultContext sets the default context for the token source, used when creating a new token request.
func WithToken ¶ added in v4.64.0
func WithToken(token oauth2.Token) TokenSourceOption
WithToken sets the default token for the token source.
Click to show internal directories.
Click to hide internal directories.