device

package
v3.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package device provides utility functions for device authentication flows as defined by RFC 8628, https://datatracker.ietf.org/doc/html/rfc8628.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthPromptFn

func DefaultAuthPromptFn(ctx context.Context, uri, userCode string) error

DefaultAuthPromptFn is the default DeviceAuthPromptFn that prints to stderr.

func NewOAuthClient

func NewOAuthClient(ctx context.Context, issuer *url.URL, clientID string, credStore credentials.Store, promptFn AuthPromptFn) (*http.Client, error)

NewOAuthClient creates an *http.Client capable of refreshing access tokens as needed. It prioritizes existing access and refresh tokens provided by the credentials.Store, falling back to device authorization as defined by RFC 8628 if necessary.

Types

type AuthPromptFn

type AuthPromptFn func(ctx context.Context, uri, userCode string) error

AuthPromptFn prompts the authorization of a device by providing the verification URI and user code to the user. The "User Interaction" step of RFC 8628 https://www.rfc-editor.org/rfc/rfc8628#section-3.3.

Jump to

Keyboard shortcuts

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