Documentation
¶
Overview ¶
Package auth implements the OAuth 2.0 Device Authorization Grant (RFC 8628) the CLI uses to sign in, plus refresh-token exchange.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PollForToken ¶
func PollForToken(ctx context.Context, host, clientID string, dc *DeviceCode) (*config.Credentials, error)
PollForToken polls the token endpoint on the interval the panel asked for, honoring authorization_pending and slow_down, until the user approves or the code expires.
Types ¶
type DeviceCode ¶
type DeviceCode struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationURIComplete string `json:"verification_uri_complete"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
DeviceCode is the panel's response to a device-code request: what to show the user and how to poll for approval.
func RequestDeviceCode ¶
func RequestDeviceCode(ctx context.Context, host, clientID, scope string) (*DeviceCode, error)
RequestDeviceCode starts the flow: it asks the panel for a user code and the verification URL to send the human to.
Click to show internal directories.
Click to hide internal directories.