flow

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAuthCodeURL added in v0.21.0

func BuildAuthCodeURL(redirectURL string, config *oauth2.Config, opts *Options) (string, error)

BuildAuthCodeURL builds the authorization URL for the OAuth2 flow

func Exchange added in v0.21.0

func Exchange(ctx context.Context, config *oauth2.Config, code string, options ...Option) (*oauth2.Token, error)

Exchange exchanges the authorization code for an access token

func GenerateCodeChallenge added in v0.21.1

func GenerateCodeChallenge(verifier string) string

GenerateCodeChallenge creates a PKCE code challenge from a code verifier

func GenerateCodeVerifier added in v0.21.1

func GenerateCodeVerifier() string

GenerateCodeVerifier creates a random code verifier for PKCE

Types

type AuthFlow

type AuthFlow interface {
	Token(ctx context.Context, config *oauth2.Config, options ...Option) (*oauth2.Token, error)
}

type BrowserFlow

type BrowserFlow struct{}

func NewBrowserFlow

func NewBrowserFlow() *BrowserFlow

func (*BrowserFlow) Token

func (s *BrowserFlow) Token(ctx context.Context, config *oauth2.Config, options ...Option) (*oauth2.Token, error)

type Option

type Option func(*Options)

func WithAuthURLParam

func WithAuthURLParam(key string, value string) Option

func WithCodeVerifier added in v0.21.0

func WithCodeVerifier(codeVerifier string) Option

WithCodeVerifier sets the code verifier for PKCE flow

func WithPKCE

func WithPKCE(enabled bool) Option

WithPKCE enables or disables PKCE flow

func WithPostParam

func WithPostParam(key string, value string) Option

func WithPostParams

func WithPostParams(values map[string]string) Option

func WithRedirectURL added in v0.21.0

func WithRedirectURL(redirectURL string) Option

func WithScopes

func WithScopes(scopes ...string) Option

func WithState

func WithState(state string) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions(opts []Option) *Options

func (*Options) CodeVerifier

func (o *Options) CodeVerifier() (string, error)

func (*Options) Scopes

func (o *Options) Scopes(scopes ...string) []string

func (*Options) State

func (o *Options) State() string

type OutOfBandFlow

type OutOfBandFlow struct{}

func NewOutOfBandFlow

func NewOutOfBandFlow() *OutOfBandFlow

func (*OutOfBandFlow) Token

func (s *OutOfBandFlow) Token(ctx context.Context, config *oauth2.Config, options ...Option) (*oauth2.Token, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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