oauthclient

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInvalidGrant

func IsInvalidGrant(err error) bool

func Revoke

func Revoke(ctx context.Context, cfg RevokeConfig) error

Types

type Config

type Config struct {
	IssuerURL        string
	ClientID         string
	Scopes           []string
	Audience         string
	AuthorizationURL string
	TokenURL         string
	UserInfoURL      string
	RevocationURL    string
	ListenPort       int
	HTTPClient       *http.Client
	Output           io.Writer
	OnDeviceCode     func(DeviceAuthorization)
}

type DeviceAuthorization

type DeviceAuthorization struct {
	VerificationURI         string
	VerificationURIComplete string
	UserCode                string
	ExpiresIn               int64
	Interval                int64
}

type LoginResult

type LoginResult struct {
	Provider         ProviderMetadata
	Tokens           TokenSet
	Identity         authstore.Identity
	AuthorizationURL string
}

func DeviceLogin

func DeviceLogin(ctx context.Context, cfg Config) (*LoginResult, error)

func Login

func Login(ctx context.Context, cfg Config) (*LoginResult, error)

type ProviderMetadata

type ProviderMetadata struct {
	IssuerURL              string
	AuthorizationURL       string
	DeviceAuthorizationURL string
	TokenURL               string
	UserInfoURL            string
	RevocationURL          string
	JWKSURL                string
	Algorithms             []string
}

func ResolveProviderMetadata

func ResolveProviderMetadata(ctx context.Context, cfg Config) (ProviderMetadata, error)

type RefreshConfig

type RefreshConfig struct {
	Provider     ProviderMetadata
	ClientID     string
	RefreshToken string
	Resource     string
	HTTPClient   *http.Client
}

type RevokeConfig

type RevokeConfig struct {
	Endpoint      string
	ClientID      string
	Token         string
	TokenTypeHint string
	HTTPClient    *http.Client
}

type TokenError

type TokenError struct {
	StatusCode       int
	ErrorCode        string
	ErrorDescription string
}

func (*TokenError) Error

func (e *TokenError) Error() string

type TokenSet

type TokenSet struct {
	AccessToken   string
	RefreshToken  string
	TokenType     string
	Expiry        time.Time
	IDToken       string
	GrantedScopes []string
}

func Refresh

func Refresh(ctx context.Context, cfg RefreshConfig) (*TokenSet, error)

Jump to

Keyboard shortcuts

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