-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to Refresh token #40
Comments
The refresh token was valid at the time you got it. But later it expired. You should always remember to refresh it before it expires. By the way, if you refresh it successfully, a new refresh token is returned and the current one expires automatically, so please remember to save the latest payload every time you refresh the token. |
So if user authenticates today and if I dont make any request for next 24 hrs, I have to ask user to authenticate again (since I can not use access token or refresh token to get new access token). In that case, I can do nothing if user does not explicitly take any action. Is it? Or am I missing something here? |
Yes. You are right. If user takes no actions, the refresh token will be expired in the end. You need to ask user to re-login. Another option is to refresh the token in regular time span explicitly in your application. BTW, according to the payload you pasted above, refresh token will be expired in 7 days. |
That's not true. You can setup a cron job to refresh the tokens. refresh_token expires in 7 days, so you need to run the cron job at least once per week. And there is something tricky you should be aware of: https://github.com/ringcentral/ringcentral-php/blob/master/src/Platform/Platform.php#L237 According to the source code, sometimes the sdk refreshes the token for you. If this happens, you'd have to save the new payload because the old one just expires. I think this is the root cause of the issue you posted. In the C# Client, there is a token refresh event so programers can easily save the latest payload taking advantages of the listener design pattern. But there isn't such thing in this PHP SDK. @anilkumarbp @kirill-konshin @grokify Please advise. |
When I try to refresh the token, I get an error "Refresh Token has Expired".
After user authorized the app, I saved entire payload which had following info...
How can I have valid refresh token to call other apis?
The text was updated successfully, but these errors were encountered: