vmware-labs / marketplace-cli

A CLI for interacting with the VMware Marketplace
Other
11 stars 2 forks source link

Better error message if the CSP API Token does not have marketplace access #107

Open petewall opened 2 years ago

petewall commented 2 years ago

If using a CSP API Token that does not have the right scopes or permissions selected when creating the token, it could return:

Field role is required
mkpcli product list --debug --debug-request-payloads
2022/06/09 15:54:20 Request [#0](https://vmware.slack.com/archives/C019E1KUCKH): GET https://gtwstg.market.csp.vmware.com/api/v1/products?managed=true&pagination={%22page%22:1,%22pageSize%22:20}
2022/06/09 15:54:20 Request [#0](https://vmware.slack.com/archives/C019E1KUCKH) Response: 422 Unprocessable Entity
Error: getting the list of products failed: (422) 422 Unprocessable Entity: {"response":{"message":["Field role is required"]}}

We should add better error messaging about token scopes and roles.