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.