vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
80 stars 76 forks source link

Add ability to authorize using a Service Account #562

Closed adezxc closed 1 year ago

adezxc commented 1 year ago

This PR is related to issue terraform-provider-vcd#995

Add support for authenticating using a Service Account

For now, the PR only enables using Service accounts that are in Active Stage so the user is expected to provide an file containing an api token .json file e.g

{"refresh_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

So the SDK will do the following steps:

  1. Read File contents
  2. Get bearer token and new refresh_token using SetApiToken
  3. Save the new refresh_token to the same file