Here’s a step-by-step that worked for me:
1. Encode creds like you did, but store them in a var first:
```powershell
$auth = "user:pass"
$encoded = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($auth))
```
2. Then, use `-Headers` *and* `-ContentType "application/json"` (if applicable).
3. Run `$Error[0] | fl -Force` after the error to get deets.
Sometimes the server’s error message hides in there.
1. Encode creds like you did, but store them in a var first:
```powershell
$auth = "user:pass"
$encoded = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($auth))
```
2. Then, use `-Headers` *and* `-ContentType "application/json"` (if applicable).
3. Run `$Error[0] | fl -Force` after the error to get deets.
Sometimes the server’s error message hides in there.
