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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With