Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthenticationTimedout = fmt.Errorf("authentication timed out") ErrCodeRejected = fmt.Errorf("confirmation code rejected") )
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { VerifyDevice(ctx context.Context) (*DeviceVerification, error) GetAccessTokenForDevice(ctx context.Context, v DeviceVerification) (string, error) }
Authenticator is the interface for authentication via device oauth
type DeviceAuthenticator ¶
type DeviceAuthenticator struct { BaseURL *url.URL Clock clock.Clock ClientID string // contains filtered or unexported fields }
DeviceAuthenticator performs the authentication flow for logging in.
func New ¶
func New(authURL string) (*DeviceAuthenticator, error)
New returns an instance of the DeviceAuthenticator
func (*DeviceAuthenticator) GetAccessTokenForDevice ¶
func (d *DeviceAuthenticator) GetAccessTokenForDevice(ctx context.Context, v *DeviceVerification) (*oauth.TokenResponse, error)
GetAccessTokenForDevice uses the device verification response to fetch an access token.
func (*DeviceAuthenticator) VerifyDevice ¶
func (d *DeviceAuthenticator) VerifyDevice(ctx context.Context, redirectURL string) (*DeviceVerification, error)
VerifyDevice performs the device verification API calls.
type DeviceCodeResponse ¶
type DeviceCodeResponse struct { DeviceCode string `json:"device_code"` UserCode string `json:"user_code"` VerificationURI string `json:"verification_uri"` VerificationCompleteURI string `json:"verification_uri_complete"` ExpiresIn int `json:"expires_in"` PollingInterval int `json:"interval"` }
DeviceCodeResponse encapsulates the response for obtaining a device code.
Click to show internal directories.
Click to hide internal directories.