Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("credential not found")
ErrNotFound is returned when a credential does not exist.
Functions ¶
func RefreshToken ¶
func RefreshToken(cfg DeviceFlowConfig, store Store, refreshToken string) (string, error)
RefreshToken exchanges a refresh token for a new access token and persists the result in the store.
func RunDeviceFlow ¶
func RunDeviceFlow(cfg DeviceFlowConfig, store Store) (string, error)
RunDeviceFlow executes the OAuth 2.0 device authorization grant flow. It prints a verification URL and user code, then polls until the user authorizes the application (or the flow times out). On success the access token is persisted via the provided Store and returned.
Types ¶
type DeviceFlowConfig ¶
type DeviceFlowConfig struct {
ClientID string
TokenURL string
DeviceAuthURL string
Scopes []string
}
DeviceFlowConfig holds the parameters for an OAuth 2.0 device authorization flow.
type Store ¶
type Store interface {
// Get retrieves a secret for the given provider name.
Get(providerName string) (string, error)
// Set stores a secret for the given provider name.
Set(providerName string, secret string) error
// Delete removes the secret for the given provider name.
Delete(providerName string) error
}
Store is the interface for credential storage backends.
Click to show internal directories.
Click to hide internal directories.