API Issues

API Issues

Hello, we have Desktop Central Cloud.  We are trying to create an automation process for removing computers during decommissioning. We stumbled upon the API. With Postman I can get a token. With powershell I can't get the popup to auth, but whatever. Postman gave me a refresh token, that should be good enough from what i read. However, from powershell, I can't get a refresh token. This would be required for our systems to run autonomously like we intend. Any assistance would be great. Note while this is a query setup, I have tried it as a body instead and get the same error.

Code:
  1. $Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
  2. $Headers.Add("Content-Type", "application/json")
  3. $TokenURL = "https://accounts.zoho.com/oauth/v2/token?refresh_token=$($Refresh_Token)&grant_type=refresh_token&client_id=$($ClientID)&client_secret=$($ClientSecret)&scope=DesktopCentralCloud.restapi.READ,DesktopCentralCloud.restapi.Update&redirect_uri=$($RedirectURI)"
  4. $TokenResponse = Invoke-RestMethod -Uri $CodeURL -Method POST -Headers $Headers
Error:
error
-----
invalid_client