device

package
v1.47.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 9 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

Overview

Package device is the login of the CLI (OAuth device flow, RFC 8628): the CLI asks a code, the account allows it on the web app, the CLI polls for its token.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Approve

func Approve(db bun.IDB) http.HandlerFunc

Approve allows or refuses, for the account logged in, the login of the CLI showing a code: POST /api/device/approve. The wrong codes in a row of an account wait longer each time: a code must not be guessed. @Summary Allow or refuse a login of the CLI @Tags account @Accept json @Param body body approvedevicecode.Input true "body" @Success 204 @Failure 400 {object} respond.Failure @Failure 401 {object} respond.Failure @Failure 403 {object} respond.Failure @Failure 404 {object} respond.Failure @Failure 429 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/device/approve [post]

func Code

func Code(db bun.IDB, origin string) http.HandlerFunc

Code starts a login of the CLI: POST /api/device/code. Public. verification_uri is on the web app's address (--origin), never the request's: the CLI may reach the server on another one. @Summary Start a login of the CLI @Tags account @Accept json @Produce json @Param body body createdevicecode.Input true "body" @Success 200 {object} createdevicecode.Result @Failure 400 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/device/code [post]

func Token

func Token(db bun.IDB) http.HandlerFunc

Token gives the CLI its token once the account allowed its code: POST /api/device/token. Public. Until then a 400 whose error is authorization_pending, slow_down, access_denied or expired_token. @Summary Poll for the token of a login of the CLI @Tags account @Accept json @Produce json @Param body body polldevicecode.Input true "body" @Success 200 {object} createapitoken.Result @Failure 400 {object} respond.Failure "authorization_pending, slow_down, access_denied or expired_token" @Failure 500 {object} respond.Failure @Router /api/device/token [post]

Types

This section is empty.

Jump to

Keyboard shortcuts

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