Documentation
¶
Index ¶
- func Request() client.ClientWithResponsesInterface
- type OAuthService
- func (s *OAuthService) Login(ctx context.Context) (string, error)
- func (s *OAuthService) Logout(ctx context.Context) error
- func (s *OAuthService) Reauthenticate(ctx context.Context) (string, error)
- func (s *OAuthService) Refresh(ctx context.Context) (string, error)
- func (s *OAuthService) Token(ctx context.Context) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Request ¶
func Request() client.ClientWithResponsesInterface
Types ¶
type OAuthService ¶ added in v1.1.0
type OAuthService struct {
// contains filtered or unexported fields
}
OAuthService obtains and maintains a bearer token via the OAuth flow. The zero value is not usable; construct one with NewOAuthService.
func NewOAuthService ¶ added in v1.1.0
func NewOAuthService() (*OAuthService, error)
NewOAuthService builds a service with the default issuer (overridable via the HOSTINGER_OAUTH_ISSUER env var) and the standard on-disk credentials path.
func (*OAuthService) Login ¶ added in v1.1.0
func (s *OAuthService) Login(ctx context.Context) (string, error)
Login runs the full interactive PKCE flow regardless of cache state.
func (*OAuthService) Logout ¶ added in v1.1.0
func (s *OAuthService) Logout(ctx context.Context) error
Logout best-effort revokes the access token and wipes local tokens, keeping the registered client_id so a later login can skip dynamic registration.
func (*OAuthService) Reauthenticate ¶ added in v1.1.0
func (s *OAuthService) Reauthenticate(ctx context.Context) (string, error)
Reauthenticate forces a fresh token, bypassing the cached-token fast path. It mirrors Token's refresh-then-login fallback and is meant for the reactive 401 recovery path, where the cached token is already known to be dead.