auth

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator struct {
	Token
	// contains filtered or unexported fields
}

func NewAuthenticator

func NewAuthenticator() (*Authenticator, error)

func (*Authenticator) FetchUserEmail added in v0.1.35

func (a *Authenticator) FetchUserEmail(ctx context.Context) error

FetchUserEmail fetches the user's email from the Auth0 userinfo endpoint. The authenticator must have a valid AccessToken set.

func (*Authenticator) Login

func (a *Authenticator) Login(c context.Context) error

func (*Authenticator) Logout

func (a *Authenticator) Logout() error

func (*Authenticator) PollForToken added in v0.1.35

func (a *Authenticator) PollForToken(ctx context.Context, dcr DeviceCodeResponse) error

PollForToken polls Auth0 for token completion after a device code request. This blocks until the user completes authentication or the context is cancelled.

func (*Authenticator) RequestDeviceCode added in v0.1.35

func (a *Authenticator) RequestDeviceCode(ctx context.Context) (DeviceCodeResponse, error)

RequestDeviceCode requests a device code for authentication. This is the first step of the device code flow - returns the code and URL for the user to complete authentication in their browser.

func (*Authenticator) SaveTokenFile added in v0.1.35

func (a *Authenticator) SaveTokenFile() error

SaveTokenFile saves the token to the auth file

func (*Authenticator) TryExistingAuth

func (a *Authenticator) TryExistingAuth(ctx context.Context) error

type DeviceCodeResponse added in v0.1.35

type DeviceCodeResponse struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationURI         string `json:"verification_uri"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
	VerificationURIComplete string `json:"verification_uri_complete"`

	Error            string `json:"error,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
}

DeviceCodeResponse contains the response from a device code request

func (DeviceCodeResponse) VerificationURL added in v0.1.35

func (d DeviceCodeResponse) VerificationURL() string

VerificationURL returns the best URL for device verification

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	Email        string    `json:"email"`
	ExpiresAt    time.Time `json:"expires_at"`
}

Jump to

Keyboard shortcuts

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