After successfully authenticated/logged in, your refresh token with expire in 7 days. Every time your access token expires, you can use the refresh token to request for a new access token. And every time you request for a new access token, the new refresh token expiration time will be set to 7 days again.
If the refresh token also expired, you must direct the user to the login page to login again.
Can you double check if the refresh token really expires or it's because of some bug in the Python SDK?
In this case, if the refresh token really expired after 7 days, you may need to implement a timer to check the expiration periodically and send a request for new access token when it nearly expires. That way you can always have a valid refresh token.
+ phong
Phong
Thanks for your assistance. How do I check the refresh token?
Hi Rick,
I don't use the Python SDK yet so I don't have exact code to show you. But I believe that after logged in, you can get the tokens info from the platform.auth().data(). When you need to refresh, just call platform.refresh() method.
Phong thanks again! Umm that does not work either, it throws same exception. Is any of this written down, anywhere? I'm trying the following:
platform.auth().refresh_token()
and or
platform.auth().data()
Does RC even work with python?
Hi Rick,
There are several users reported "Refresh Token has Expired" and they are not using Python at all. So I wonder this might be an issue from RC server side.
Could you please do me a favor? Try my Python SDK:
https://github.com/tylerlong/ringcentral-pythonBy the way, there is a way to auto refresh the token:
https://github.com/tylerlong/ringcentral-python#authorization-refreshIf you still have the issue, please post the code to reproduce the issue. By then we can confirm it is a RC server side issue or not.
Ok some progress
this
r = rc.post('
https://platform.ringcentral.com/restapi/v1.0/account/1NNNNN/104/NNNNNNN/sms-log?dateFrom=2...', {
throws
Exception: HTTP status code: 404
"errorCode" : "AGW-404",
"message" : "Resource not found",
Thanks
Yes, I shortened it to this
https://platform.ringcentral.com/restapi/v1.0/ as well as several other variations and no go? Any idea what its supposed to be? I got the above from ringcentrals own documentation?!? So either i'm reading it wrong, or they have another error. All this thing has to do is send an SMS.
Tyler forgot to include
rc.authorize("Username", "password")
Sorry about that.
Hmm, well now Im getting
Exception: HTTP status code: 400
{
"error" : "unauthorized_client",
"error_description" : "Unauthorized for this grant type",
"errors" : [ {
"errorCode" : "OAU-251",
"message" : "Unauthorized for this grant type"
} ]
}
when I call rc.authorize('+NNNNNNN', '', 'password')
This is absurd I've done this with twilio send and receive in under 30mins...Not sure what the deal is but Im ready to cry uncle.
Tyler, I got it worjing! Thanks so much friend, you rock! Had to delete it and start from scratch but it works now! Again thanks 1000% for your patience!!