fix token issue which results in endless loop on reauth
Related-PROD: PROD-30429
Change-Id: I17061614332e7b748d3b00e2746336f3b6d7270f
diff --git a/provider_client.go b/provider_client.go
index f886823..01b3010 100644
--- a/provider_client.go
+++ b/provider_client.go
@@ -145,10 +145,6 @@
}
req.Header.Set("Accept", applicationJSON)
- for k, v := range client.AuthenticatedHeaders() {
- req.Header.Add(k, v)
- }
-
// Set the User-Agent header
req.Header.Set("User-Agent", client.UserAgent.Join())
@@ -162,6 +158,11 @@
}
}
+ // get latest token from client
+ for k, v := range client.AuthenticatedHeaders() {
+ req.Header.Set(k, v)
+ }
+
// Set connection parameter to close the connection immediately when we've got the response
req.Close = true