Google Calendar Scheduler no longer working

I have been using the Google Calendar Scheduler (https://www.openhab.org/addons/integrations/gcal/) for over a year with great succes.

A few weeks ago, it started throwing errors:

2020-03-14 14:54:02.521 [INFO ] [b.core.service.AbstractActiveService] - Google Calendar Event Downloader has been started
2020-03-14 14:54:02.527 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Loaded credential
2020-03-14 14:54:02.528 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device access token: null
2020-03-14 14:54:02.530 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device refresh_token: 1//09ikvUL_...etc
2020-03-14 14:54:02.531 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - device expires_in: null
2020-03-14 14:54:03.090 [ERROR] [openhab.io.gcal.auth.GCalGoogleOAuth] - authentication failed: 400 Bad Request
{
  "error" : "invalid_grant",
  "error_description" : "Bad Request"
}

I reinstalled the binding, I checked if my Raspberry had no time sync issues, created a new client id + secret, nothing helps.

My services config:

client_id=10---6049475-4ltkm18qc7lit-----
client_secret=uOw7Eg----
calendar_name=Trash

It seems strange to me that the access token is null, should this be the case?

Have you updated OH lately or this just started on it’s own? What version of OH are you using?

Have you tried stopping OH, cleaning the cache and restarting a few times since creating a new client ID?

I have been on 2.5 since that was released, was on beta 2 before that. The last time it worked, as far as I can see was 18 February. I was migrated long before that so it did work with 2.5. I have tried rebooting OH, that didn’t help. Are you also using the binding and if so, what are you seeing as a value for the acces_token, is that null?

Did you also try cleaning the cache? FYI, it’s been posted several times in the forum that since 2.5 restarting OH several times is needed. For me it usually takes 2 restarts before things start working correctly.

I am not using this binding.

I rebooted a couple of times but didn’t help. I will also try to clear the cache, and if that doesn’t work I will use the other caldev binding.

So, when scrolling through the documentation one last time, I suddenly saw:

If you later change your client_id and client_secret in the configuration, you will have to locate and delete the file gcal_oauth2_token, and stop and restart the service. This is because the Google Calendar Scheduler does not detect that the OAuth token is no longer valid. On openHAB 2.0.0 installed via apt-get, this file is located in the directory /var/lib/openhab2/gcal

Whenever the error occurred, I did not change my secret/id but 2 weeks ago I did to debug this issue. So I removed the file and now it works again!