auth

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func Refresh

func Refresh(ctx context.Context, c *config.Credentials) error

Refresh exchanges the stored refresh token for a fresh access token, updating c in place. The caller is responsible for persisting c afterwards.

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.

Jump to

Keyboard shortcuts

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