Description
Using a shared OauthClient in concurrent workers causes inconsistent token responses.
Code snippet
oauthClient := client.NewOauthClient(user, apiKey, true)
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_, _ = oauthClient.CreateToken(context.Background(), scopes, 3600)
}()
}
wg.Wait()
Observed behavior
Occasional malformed responses or errors.