Documentation
¶
Overview ¶
Package auth implements Garmin SSO login and token persistence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMFARequired = errors.New("mfa required")
)
View Source
var ErrNotAuthenticated = errors.New("not authenticated (run `garmin auth login`)")
Functions ¶
func SaveSession ¶
Types ¶
type OAuth1Token ¶
type OAuth2Token ¶
type OAuth2Token struct {
Scope string `json:"scope"`
JTI string `json:"jti"`
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
ExpiresAt int64 `json:"expires_at"`
RefreshTokenExpiresIn int `json:"refresh_token_expires_in"`
RefreshTokenExpiresAt int64 `json:"refresh_token_expires_at"`
}
func RefreshOAuth2 ¶
func RefreshOAuth2(ctx context.Context, configDir string, oauth1 OAuth1Token) (OAuth2Token, error)
RefreshOAuth2 exchanges the OAuth1 token for a fresh OAuth2 token.
type Session ¶
type Session struct {
OAuth1 OAuth1Token
OAuth2 OAuth2Token
}
Session contains OAuth credentials needed to call connectapi.garmin.com.
func LoadSession ¶
Click to show internal directories.
Click to hide internal directories.