devicecode

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAccessDenied is an error returned when the user has denied this
	// app access to their account.
	ErrAccessDenied = errors.New("access denied by user")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	*oauth2.Config
	DeviceCodeURL string
}

A version of oauth2.Config augmented with device endpoints

func New

func New(clientID string, clientSecret string, scopes []string) *Config

func NewWithDomain

func NewWithDomain(domain string, clientID string, clientSecret string, scopes []string) *Config

func (*Config) Token

func (c *Config) Token(ctx context.Context, client *http.Client) (*oauth2.Token, error)

WaitForDeviceAuthorization polls the token URL waiting for the user to authorize the app. Upon authorization, it returns the new token. If authorization fails then an error is returned. If that failure was due to a user explicitly denying access, the error is ErrAccessDenied.

Jump to

Keyboard shortcuts

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