Reputation: 165
I am using the RingCentral JS SDK (v. 3.1.1). I use the API from my server only so I am using a password workflow with the function rcsdk.platform().login()
(from the doc here).
I am using the API only to send SMS for now.
Everything was working fine until yesterday. Then when I had to send an SMS, I got the error Refresh Token is missing
.
I am aware of the refresh function in the SDK. The line 392 seems to be the one throwing my error. What I don't know is why, since I am using correct username, password and so on.
Sending SMS is a vital part of my user workflow, what am I missing here?
Upvotes: 3
Views: 951
Reputation: 779
I had the same problem, and while I'm not sure we were making the same mistake the root cause was that the Auth was not being set properly. I was using rcsdk.platform().auth().setData(authData)
to set the data but unfortunately I was not formatting authData properly as JSON first.
Upvotes: 2
Reputation: 211
The documentation said "The SDK takes care of the token lifecycle. It will refresh tokens for you automatically. ..."
Do you handle the refresh token manually? Did you check if it has a valid token by calling this:
rcsdk.platform().auth().accessTokenValid(); // returns boolean
You can also implement the following code and print some log to see if the refresh token failed some how.
platform.on(platform.events.refreshError, function(e){
// do something, usually open a login page
});
Upvotes: 4