Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { StatusCode int Body *ErrorResponse }
APIError is returned by FetchUserCode or PollToken when Auth0 API request is failed.
type DeviceAuthFlow ¶
type DeviceAuthFlow struct {
// contains filtered or unexported fields
}
DeviceAuthFlow manages Auth0's Device Authorization Flow.
func NewDeviceAuthFlow ¶
func NewDeviceAuthFlow(opts ...DeviceAuthFlowOption) (*DeviceAuthFlow, error)
NewDeviceAuthFlow returns new instance of DeviceAuthFlow.
To configure, please pass WithBaseURL and WithClientID
func (*DeviceAuthFlow) BaseURL ¶
func (daf *DeviceAuthFlow) BaseURL() string
func (*DeviceAuthFlow) ClientID ¶
func (daf *DeviceAuthFlow) ClientID() string
func (*DeviceAuthFlow) FetchDeviceCode ¶
func (daf *DeviceAuthFlow) FetchDeviceCode(scope string, audience string) (*DeviceCodeResponse, error)
FetchDeviceCode requests device code endpoint and returns a DeviceCodeResponse
func (*DeviceAuthFlow) PollToken ¶
func (daf *DeviceAuthFlow) PollToken(dc *DeviceCodeResponse) (*TokenResponse, error)
PollToken polls token endpoint and returns a TokenResponse when verified.
When verification is expired, it returns ExpiredError.
type DeviceAuthFlowOption ¶
type DeviceAuthFlowOption interface {
// contains filtered or unexported methods
}
type DeviceCodeResponse ¶
type DeviceCodeResponse struct { DeviceCode string `json:"device_code"` UserCode string `json:"user_code"` VerificationURI string `json:"verification_uri"` VerificationURIComplete string `json:"verification_uri_complete"` ExpiresIn int `json:"expires_in"` Interval int `json:"interval"` ExpiresAt time.Time `json:"-"` }
DeviceCodeResponse represents response of Auth0's device code endpoint
See: https://auth0.com/docs/api/authentication#device-authorization-flow In addition, it has ExpiresAt which means expiration date of the device code.
type ErrorResponse ¶
type ErrorResponse struct { Error string `json:"error"` ErrorDescription string `json:"error_description"` }
ErrorResponse represents error response of Auth0
See: https://auth0.com/docs/api/authentication#standard-error-responses
type ExpiredError ¶
type ExpiredError struct {
ExpiresIn int
}
func (*ExpiredError) Error ¶
func (e *ExpiredError) Error() string
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` IdToken string `json:"id_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` }
TokenResponse represents response of Auth0's token endpoint
See: https://auth0.com/docs/api/authentication#device-authorization-flow48
type WithBaseURL ¶
type WithBaseURL string
type WithClientID ¶
type WithClientID string