I’ve stuck into a weird situation.
Here is my application workflow.
I manually authenticate my application and store the tokens in database.
After every 12 hours ( just for testing) I run a CRON job to refresh my tokens. After ~4 time my CRON job runs (2 days) I started getting TokenExpiredException.
I can’t get rid of this issue unless I remove the tokens from database and manually authenticate myself again.
How do I cope with this issue.
Thank you so much.
Hi @Khurram_Shahzad,
That does sound rather un-usual. You really won’t be able to tell anything on your own unless you are capturing the results of the calls. Are you keeping log files?
It’s a Laravel application so I have Laravel log file. I have CRON job log as well which simply states tokens were refreshed or not.
Is there any specific log you want me to capture.
P.s: Tokens are refreshing properly.
I would actually store the refresh and access token in a separate log with time stamp and then compare the last update that failed with what is in your database. If they are refreshing correctly then move to the next “joint” in the process. If they match then start your own log for the token retrieval process.
@Khurram_Shahzad are you using an actual cron job or a scheduled job using the Laravel Scheduler? I have a sample application using the scheduler that has been refreshing tokens without issue for 2 years now.
If you can log the actual response you are getting back that would be helpful. You can enable debugging in the SDK by following the README. I would suggest using monolog so it stores it to a log file you can grab later on.
1 Like
Thanks @MichaelFairchild
Currently I am using actual cron job. I’ve implemented the logger now.
I’ve manually refreshed the tokens ~10 times and its working fine for now.
Let’s see if the problem arises again when the cron job will run.
1 Like