Google Calendar sync stops working after a day – please check your token

Support forumCategory: QuestionsGoogle Calendar sync stops working after a day – please check your token
Jon asked 3 years ago
Hi, After about a day the sync stops and when checking the calendars in the advanced section I am advised to check my token. So far I am having to delete the calendar and go through the process to authorising the token again, logging into google and permitting the access.  I seem to be following all the instructions correctly, however its don't this a few times now. I did see another thread where you mentioned this and discussed short term token / long term token but I am not sure how to check what type of token has been authorised or requested. Your assistance would be most welcome.
10 Answers
Nikola Loncar Staff answered 3 years ago
Hi, when you have new token please do the following. Click on the remove token and then reauthorize again. After that you should have a long term token. Best regards, Nikola
Zebrano answered 3 years ago
Many thanks, I have removed the token and reauthorised once more, and confirming once again with google that I trust and allow the app.   I will let you know in a few days how it goes if that's ok or if the problem persists. Thanks again for the super quick reply.    
Nikola Loncar Staff answered 3 years ago
You're welcome, I will close this thread since there are no new updates :) Best regards, Nikola
Zebrano answered 3 years ago
Hi again, sorry to bring this back up but I have to log in every few weeks still to re-authenticate the token with Google. Is there any more insight as to why this is needed as I cannot work out how to resolve it. There is nothing in the documents that addresses why this may happen or how to resolve it. Desperate to get this resolved if you are able to assist in anyway.
Nikola Loncar Staff answered 3 years ago
Hi we were checking what could be reason for that. Please check this link https://blog.timekit.io/google-oauth-invalid-grant-nightmare-and-how-to-fix-it-9f4efaf1da35 Could be a lot of things. Do you use that same account on different apps? Also could be a high volume of API calls. If that is the case maybe to change sync interval. Best regards, Nikola
Zebrano answered 3 years ago
Hi, I shall investigate the link and the options it suggests. There is only 2 apps running, one which is yours and the other that sends the email from gmail, the email edition was only added recently and the issue was present before anyway. The sync is set to the default at the moment so may increase that as suggested. Allow me to make the suggested changes and come back to you if that\'s ok?  
Mike answered 3 years ago
We've noticed the same issue on one of our sites.  The Google Calendar sync stops working randomly and we need to reauthenticate.  I'm trying to connect using a different Google account now, and will see if that helps to keep the token alive.
Nikola Loncar Staff answered 3 years ago
Hi Mike can you please share the result for that new Account that was used? Best regards, Nikola
Mike replied 3 years ago

Hi Nikola,

So far, it looks like the new account is working. It seems like if you are using an account that authenticates frequently for other apps, that the token expires for EA. I created a new Google account, shared the calendar with that new account, and used the new account for EA, and it seems to be working fine now.

Mike replied 3 years ago

It stopped working again. The account we’re using to authenticate is ONLY being used for Easy Appointments, and the connection still stopped working after a while.

Mike answered 3 years ago
The token expires and stops working exactly 7 days after authenticating. According to the logs, we authenticated on 5/6/21 at 16:48 and the sync worked starting then.   The token stopped working and sync failed beginning on 5/13/21 at 16:50. This has continuously occurred for the past several weeks, I believe it might have started after a plugin update since we have another site that uses an older version of EasyAppointments that has not had these issues.
Nikola Loncar Staff answered 3 years ago
Hi Mike I think I know why. Here is from docs: A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days. can you please go to Google App settings and set it to production please. Best regards, Nikola
Mike replied 3 years ago

Hi Nikola!

I just switched the app to production, if we still have a connection in 7 days then that definitely was the issue.

Thank you for getting back to me on this!

Nikola Loncar Staff replied 3 years ago

Please also remove and reauthorize once more time just to have fresh token with new refresh key.

Best regards,
Nikola

Zebrano replied 3 years ago

I also have just followed the above so will report back as well the outcome.

Thank you both for assisting with this “interesting” issue.