Documentation
¶
Index ¶
- type Authenticator
- func (a *Authenticator) FetchUserEmail(ctx context.Context) error
- func (a *Authenticator) Login(c context.Context) error
- func (a *Authenticator) Logout() error
- func (a *Authenticator) PollForToken(ctx context.Context, dcr DeviceCodeResponse) error
- func (a *Authenticator) RequestDeviceCode(ctx context.Context) (DeviceCodeResponse, error)
- func (a *Authenticator) SaveTokenFile() error
- func (a *Authenticator) TryExistingAuth(ctx context.Context) error
- type DeviceCodeResponse
- type Token
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) 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