While invoking an Invoke-RestMethod
using Powershell like:
Invoke-RestMethod -Method Get -Uri "https://google.com/api/GetData" -Headers $headers
and $headers
being
$headers = @{
Authorization="Secret $username $password"
Content='application/json'
}
What is the format expected for the parameters $username
and $password
?
As far as I know you have to send a OAuth2 token in the request headers.
$headers = @{
Authorization="Bearer $token"
}
Perhaps the following blog post gives you an idea how to do so. https://lazyadmin.nl/it/connect-to-google-api-with-powershell/