Hi,
We are trying to extend our existing PowerShell scripts for new and updating user accounts to include RingCentral. The script already connects successfully to our contact centre and Azure using Bearer tokens.
We've created an account and an app within RingCentral and created a JWT for the sandbox. I'm now trying to connect to the sandbox API, prior to testing the account processes.
Having checked several forum posts, solve the OAU-152 issue by changing the Uri to /authorize instead of /token which the documentation says to use.
Unfortunately, all my attempts now lead to OAU-155 errors (client id is undefined).
Here is my code (with access codes abbreviated):
#Pre-defined access codes
$ClientID = "Wd..."
$ClientSecret = "XK..."
$JWT = "ey..."
#Convert codes
$ClientDetails = $ClientID+":"+$ClientSecret
$EncodedClient = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($ClientDetails))
#Create headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/json")
$headers.add("Content-Type", "application/x-www-form-urlencoded")
$headers.add("Authorization", "Basic $EncodedClient")
#Make grant type uri-friendly
$GrantType = [uri]::EscapeDataString("urn:ietf:params:oauth:grant-type:jwt-bearer")
#Create body
$body = @{
grant_type = $GrantType
assertion = $JWT
response_type = "code"
}
#Authorise
$response = Invoke-RestMethod -Uri "https://platform.devtest.ringcentral.com/restapi/oauth/authorize" -Method Post -Headers $headers -Body $body
Is this error message telling me that the codes supplied are undefined in RingCentral (but they're listed in our portal) or that the client id is undefined in the request (it's clearly in the request header)?
Any assistance will be gratefully received
Dan