We were using Ring Central last year but the service was terminated. We just re-started the service and I would like to use the existing code to access our new account.
Below is the code to get an SMS Token. We were using the phone number as the Username. Where can I get the “Authorization” code, username and password to get a “Token”?
Thanks!
Public Shared Function GetSmsToken() As String
Dim client = New RestClient("https://platform.ringcentral.com/restapi/oauth/token")
'client.Timeout = -1
Dim request = New RestRequest(Method.Post)
' request.Timeout = -1
request.AddHeader("Authorization", "Basic R3hGUlk3S05RSmFUeTlMU19nbjR1dzp4alNlY3Y2alJHaVo2Ul9YTzdmUnVRUW5weXVlY0xUUk8xcDlTTUhuZGc0QQ==")
request.AddHeader("Content-Type", "application/x-www-form-urlencoded")
request.AddParameter("grant_type", "password")
request.AddParameter("username", userName)
request.AddParameter("password", "xxxxx")
request.AddParameter("extension", "101")
Dim response As RestResponse = client.Execute(request)
Console.WriteLine(response.Content)
Dim jobj = JObject.Parse(response.Content)
If Not jobj.ContainsKey("access_token") Then
Throw New Exception($"Access token not found in response. Body:\r\n{response.Content}")
End If
Return jobj("access_token").ToObject(Of String)()
End Function