News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Password to JWT Migration
Tags: errors
Sep 9, 2023 at 5:58am   •   1 replies  •  0 likes
Glenn B.

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?

1 Answer
answered on Sep 9, 2023 at 9:17am  

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.


 0
on Sep 9, 2023 at 10:27am   •  0 likes

Implemented - tested - works perfectly. Thank you again!

on Sep 9, 2023 at 9:40am   •  0 likes

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



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us