Help us shape the future of Go! Take the 2026 Go Developer Survey

remoteoauth

package
v4.99.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

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)

NewTokenSource creates a new token source. Deprecated: Use oauth2.StaticTokenSource directly instead.

func TokenAuthEditor added in v4.61.0

func TokenAuthEditor(tokenSource oauth2.TokenSource) func(context.Context, *http.Request) error

TokenAuthEditor returns a custom RequestEditorFn to inject the OAuth2 token

Types

type RewriterFunc added in v4.61.0

type RewriterFunc func(*http.Request, oauth2.Token)

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

func (*TokenAuthTransport) RoundTrip added in v4.61.0

func (t *TokenAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction and injects the token into the request header

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(_ context.Context) TokenSourceOption

WithDefaultContext sets the default context for the token source, used when creating a new token request. Deprecated: not used in the current implementation.

func WithToken added in v4.64.0

func WithToken(token oauth2.Token) TokenSourceOption

WithToken sets the default token for the token source. Deprecated: Use oauth2.StaticTokenSource directly instead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL