Skip to main content
Solved

Password to JWT Migration

  • September 9, 2023
  • 3 replies
  • 312 views

We use VBA code that loops through a recordset and sends SMS text messages to customers as appointment reminders. The SMS text messages sent are sent from the RC telephone number of the employee assigned to the customer receiving the SMS. Our existing code (using password auth) in our app has been working flawlessly for a long time.

In our existing app - using Password Auth - our request header is structured like this:

http.Send "grant_type=password" & "&username=" & strRCEmployeeTel & "&password=" & strRCEmployeePwd & "&extension=" & strRCEmployeeExtension

Later in the Password Auth code - we SEND the SMS from the RCEmployeeTel using this code:

http.Send "{" & """to"": [{""phoneNumber"": """ & strCustomerPhone & """}]," & """from"": {""phoneNumber"": """ & strRCEmployeeTel & """}," & """text"": """ & strMsg & """" & "}"

Moving to our JWT Auth app we are working on - our request header is structured like this:

http.Send "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=" & JWToken

Later in the JWT Auth code - when we attempt to SEND the SMS from the RCEmployeeTel using the same code as above:

http.send "{" & """to"": [{""phoneNumber"": """ & strCustomerPhone & """}]," & """from"": {""phoneNumber"": """ & strRCEmployeeTel & """}," & """text"": """ & strMsg & """" & "}"

We get this error:

{
  "errorCode" : "FeatureNotAvailable",
  "message" : "Phone number doesn't belong to extension",
  "errors" : [ {
    "errorCode" : "MSG-304",
    "message" : "Phone number doesn't belong to extension"
  } ]
}

We thought that the JWT would allow us to send SMS from any of our employee RC telephone numbers - but clearly that is not the case.

Can anyone suggest how we can address the above error?

Best answer by PhongVu

Use the username and password of the employee who owns the phone number (the one you authenticated the app before), to login the RingCentral Dev portal and generate a JWT token for that employee, then use the JWT to authenticate your app.

JWT is just a replacement for using the username and password of a user. So it must be per user and can be used to authenticate just that user.

View original
Did this thread help you find an answer to your question?

3 replies

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2330 replies
  • Answer
  • September 9, 2023

Use the username and password of the employee who owns the phone number (the one you authenticated the app before), to login the RingCentral Dev portal and generate a JWT token for that employee, then use the JWT to authenticate your app.

JWT is just a replacement for using the username and password of a user. So it must be per user and can be used to authenticate just that user.


  • Author
  • New Participant
  • 2 replies
  • September 9, 2023

Thank you Phong! Will set this up and do some testing.


  • Author
  • New Participant
  • 2 replies
  • September 9, 2023

Implemented - tested - works perfectly. Thank you again!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings