From b015f6f02f145f35c831d87376ceaad9e3d83b88 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 Signed-off-by: Mark Peek --- 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)