What is the equivalent of
curl -u username:password ...
in PowerShell's Invoke-RestMethod? I tried this:
$securePwd = ConvertTo-SecureString "password" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($username, $securePwd)
Invoke-RestMethod -Credential $credential ...
but it returns 401, Unauthorized.
-Authentication Basicas a parameter toInvoke-RestMethod? The rest being identical, it works for me just fine. Context: I am pulling the creds from env variables and querying Zendesk HelpCenter API.