...
This commit is contained in:
parent
4d489f1686
commit
dfa4fcb54e
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue