From b442d4be9239eac641e1e5ce90b5c352b510f5ac Mon Sep 17 00:00:00 2001 From: Mark Peek Date: Sat, 16 Mar 2019 15:25:20 -0700 Subject: [PATCH] Don't auth if there is an existing bearer token --- sdk/vra_client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/vra_client.go b/sdk/vra_client.go index 3f897a6..9e22fa6 100644 --- a/sdk/vra_client.go +++ b/sdk/vra_client.go @@ -38,7 +38,9 @@ func (c *APIClient) DoRequest(req *APIRequest, login bool) (*APIResponse, error) return nil, err } if !login { - c.Authenticate() + if c.BearerToken == "" { + c.Authenticate() + } r.Header.Add(AuthorizationHeader, c.BearerToken) } r.Header.Add(ConnectionHeader, CloseConnection)