auth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package auth implements the Auth0 device-code OAuth flow and the operator auth subcommands.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthorizationPending = errors.New("authorization pending")
	ErrSlowDown             = errors.New("slow down")
	ErrAccessDenied         = errors.New("access denied")
	ErrExpiredToken         = errors.New("device code expired")
)

Auth0 device-code well-known errors per RFC 8628 § 3.5.

Functions

func NewCmd

func NewCmd() *cobra.Command

NewCmd returns the `yomiro auth` command tree.

Types

type DeviceCodeClient

type DeviceCodeClient struct {
	Domain   string
	ClientID string
	Audience string
	Scheme   string
	HTTP     *http.Client
}

DeviceCodeClient talks to an Auth0 tenant using the device-authorization flow (RFC 8628). Scheme is "https" in production; tests inject "http".

func (*DeviceCodeClient) Poll

func (c *DeviceCodeClient) Poll(deviceCode string) (string, error)

Poll exchanges the device code for an access token. Caller is responsible for the polling loop and respecting the interval / slow_down hint.

func (*DeviceCodeClient) PollUntilDone

func (c *DeviceCodeClient) PollUntilDone(deviceCode string, interval int, expiresIn int) (string, error)

PollUntilDone runs Poll on a ticker, respecting authorization_pending and slow_down. Returns the access token or an error.

func (*DeviceCodeClient) Start

func (c *DeviceCodeClient) Start() (*deviceCodeResponse, error)

Start initiates a device authorization request and returns the user-facing code, verification URL, and polling parameters.

Jump to

Keyboard shortcuts

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