diff --git a/esi_sso.go b/esi_sso.go index bd54f13..5473978 100644 --- a/esi_sso.go +++ b/esi_sso.go @@ -97,7 +97,7 @@ func (s *SSO) initDB() error { return nil } -// GetToken returns a valid access token for the given character name +// GetCharacter returns a valid character object for the given character name // If no token exists, it will start the OAuth flow // If token is expired, it will refresh it automatically func (s *SSO) GetCharacter(ctx context.Context, characterName string) (Character, error) { @@ -128,7 +128,7 @@ func (s *SSO) GetCharacter(ctx context.Context, characterName string) (Character } // Check if token needs refresh - if time.Now().After(char.ExpiresAt.Add(-12 * time.Hour)) { + if time.Now().After(char.ExpiresAt.Add(-1 * time.Minute)) { logger.Info("Token for character %s is expired or expiring soon, refreshing", characterName) if err := s.refreshToken(ctx, char); err != nil { logger.Warning("Token refresh failed for character %s, re-authenticating: %v", characterName, err)