Documentation
¶
Index ¶
- type DatabaseService
- type Service
- func (s *Service) ExchangeToken(authCode string) error
- func (s *Service) GetAuthURL() string
- func (s *Service) GetClient() (*oauth2.Config, *oauth2.Token, error)
- func (s *Service) GetTokenInfo() (*TokenInfo, error)
- func (s *Service) GetValidToken() (*oauth2.Token, error)
- func (s *Service) RefreshToken(token *oauth2.Token) (*oauth2.Token, error)
- func (s *Service) ValidateToken() error
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseService ¶
type DatabaseService interface { SaveTokenConfig(config *database.TokenConfig) error GetTokenConfig() (*database.TokenConfig, error) }
DatabaseService interface defines the methods needed from database service
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles OAuth2 authentication for Google Drive API
func NewService ¶
func NewService(clientID, clientSecret string, redirectURL string, dbService DatabaseService) *Service
NewService creates a new auth service
func (*Service) ExchangeToken ¶
ExchangeToken exchanges authorization code for tokens and saves them
func (*Service) GetAuthURL ¶
GetAuthURL returns the authorization URL for OAuth2 flow
func (*Service) GetTokenInfo ¶
GetTokenInfo returns information about the current token
func (*Service) GetValidToken ¶
GetValidToken returns a valid token, refreshing if necessary
func (*Service) RefreshToken ¶
RefreshToken refreshes the token and save it to the database
func (*Service) ValidateToken ¶
ValidateToken validates the stored token by making a test API call
Click to show internal directories.
Click to hide internal directories.