Documentation
¶
Overview ¶
Package auth implements the Auth0 device-code OAuth flow and the operator auth subcommands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.