This commit is contained in:
Andrey Parhomenko 2024-01-30 23:33:40 +03:00
parent 4d489f1686
commit dfa4fcb54e

View file

@ -278,7 +278,7 @@ func (api *Client) ExchangeAuth() (*TokenPair, error) {
func (api *Client) RefreshTokenIfExpired() error { func (api *Client) RefreshTokenIfExpired() error {
now := time.Now() now := time.Now()
if now.After(api.options.ExpirationAt.Add(-time.Second*2)) { if now.After(api.options.ExpirationAt) || now.Equal(api.options.ExpirationAt){
_, err := api.RefreshToken() _, err := api.RefreshToken()
if err != nil { if err != nil {
return err return err