question

Andy Miscuk avatar image
Andy Miscuk asked Andy Miscuk answered

OAU-251 Am I building the body wrong?

Sub GetAccessToken()
  Dim MyRequest As Object
  Dim strJWT As String
  Dim strURL As String
  Dim strBody As String
  Dim strEncode64Base As String
  Dim strClientSecret As String
  Dim strClientID As String

  strURL = "https://platform.devtest.ringcentral.com/restapi/oauth/token"
  strJWT = "ey....Shortened..cfA"
  strClientSecret = "Jn....Shortened..rg"
  strClientID = "Lj....Shortened..FA"

  strEncode64Base = EncodeBase64(strClientID & ":" & strClientSecret)
  Debug.Print strEncode64Base

  strBody = "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&" & "assertion=" & strJWT
  Debug.Print "STRBODY: " & strBody

  Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")

  MyRequest.Open "POST", strURL, False
  MyRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
  MyRequest.SetRequestHeader "Accept", "application/json"
  MyRequest.SetRequestHeader "Authorization", "Basic " & strEncode64Base
  MyRequest.Send strBody
  Debug.Print MyRequest.ResponseText
  Set MyRequest = Nothing
End Sub

Have I configured the account wrong?

is the Body wrong?

How should I format the body?

Thanks for any help you can provide.

Andy


errors
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Andy Miscuk avatar image
Andy Miscuk answered

I found the issue. Mismatched credentials.......

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys