Documentation
¶
Overview ¶
Package devicecode implements the shared device code polling loop for OAuth flows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPending = errors.New("authorization pending")
ErrPending indicates the user has not yet authorized.
View Source
var ErrSlowDown = errors.New("slow down")
ErrSlowDown indicates the poll interval should be increased.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// UserCode is the code the user must enter in the browser.
UserCode string
// VerificationURL is the URL the user must visit.
VerificationURL string
// Interval is the minimum seconds between poll attempts.
Interval int
// ExpiresIn is the total seconds before the device code expires.
ExpiresIn int
// Poll is called on each iteration. It must return the result token or a sentinel error.
// Return ErrPending to continue polling, ErrSlowDown to increase interval.
Poll func(ctx context.Context) (string, error)
}
Config describes a device code polling session.
Click to show internal directories.
Click to hide internal directories.