createdevicecode

package
v1.47.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 11 Imported by: ? 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

Index

Constants

View Source
const Interval = 5 * time.Second

Interval is how long the CLI waits between two polls.

View Source
const Length = 8

Length is the number of characters of a user code: 20^8, about 2.6e10 codes.

View Source
const Lifetime = 10 * time.Minute

Lifetime is how long the user has to allow the CLI on the web app.

Variables

This section is empty.

Functions

func Process

func Process(ctx context.Context, db bun.IDB, input Input, origin string) *run

Process starts a login of the CLI (OAuth device flow): a code the user allows on the web app at origin, unknown to any account until then.

Types

type Input

type Input struct {
	// Name names the token the login gives, in the account's settings: "CLI – <hostname>".
	Name string `json:"name"`
}

type Result

type Result struct {
	DeviceCode string `json:"device_code"`
	// UserCode is shown as XXXX-XXXX; the web app may send it in any case, with or without the dash.
	UserCode string `json:"user_code"`
	// VerificationURI is the web app's page where the user types the code; relative ("/device") when the server
	// has no --origin: the CLI joins it to its server's address.
	VerificationURI string `json:"verification_uri"`
	// VerificationURIComplete has the code in it already.
	VerificationURIComplete string `json:"verification_uri_complete"`
	// ExpiresIn is in seconds.
	ExpiresIn int `json:"expires_in"`
	// Interval is the seconds to wait between two polls.
	Interval int `json:"interval"`
}

Result is what the CLI shows (the user code and where to type it) and keeps (the device code, to poll with).

Jump to

Keyboard shortcuts

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