Documentation
¶
Index ¶
- func DeprecatedError(action string) error
- func EnvRefreshToken() string
- func GetToken() (string, error)
- func Login(email, password string) error
- func Logout() error
- func ResolveAPIBase() string
- func Save(store *TokenStore) error
- func SaveFromCapture(accessToken, refreshToken, expiresAt string) error
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeprecatedError ¶ added in v1.0.6
func EnvRefreshToken ¶ added in v1.3.1
func EnvRefreshToken() string
EnvRefreshToken returns the refresh token supplied via the environment, or "" when unset. When set it takes precedence over the saved token file.
func ResolveAPIBase ¶ added in v1.0.6
func ResolveAPIBase() string
ResolveAPIBase returns the env override LIFTOFF_API_BASE if set, else the compiled-in default. Liftoff mints version-pinned hosts (e.g. v2-13-0) and retires older ones; the env var lets users dodge a deprecation without waiting for a new release. Logged once when an override is in effect so users can tell which endpoint is active when something breaks.
func Save ¶
func Save(store *TokenStore) error
func SaveFromCapture ¶
SaveFromCapture stores tokens captured manually (e.g. from MITM).
Types ¶
type TokenStore ¶
type TokenStore struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt time.Time `json:"expires_at"`
}
func Load ¶ added in v1.1.0
func Load() (*TokenStore, error)
Load reads the saved token store without attempting a refresh. Returns (nil, error) when no token has been saved yet. Suitable for non-mutating status checks; use GetToken when an action needs a usable access token.
func Refresh ¶
func Refresh(refreshToken string) (*TokenStore, error)
Refresh exchanges a refresh token for a new access token and saves the result. Use refresh directly when the tokens must not touch disk.