Skip to content

Commit

Permalink
Add code to delete the client token on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Aug 22, 2021
1 parent a09c0af commit 8538312
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ func (client *Client) refreshToken(ctx context.Context) error {
client.mutex.Lock()
defer client.mutex.Unlock()

client.token = ""

token, _, err := client.Token(ctx)
if err != nil {
return err
}

client.token = token.Token
client.tokenExpirationTime = time.Now().UTC().Unix() + token.ExpiresIn - 100 // Give extra 100 second buffer
client.tokenExpirationTime = time.Now().UTC().Unix() + token.ExpiresIn - 1000 // Give extra 100 second buffer

return nil
}
Expand Down

0 comments on commit 8538312

Please sign in to comment.