I am encountering the following error message during a Google Analytics import, using Matomo Cloud:
Error message: Error on day (unknown), { "error": "invalid_grant", "error_description": "Bad Request" }
These errors are unexpected and will likely continue every time you run the import on this day. To resolve this issue, please ask on the forums. If you can provide access to your GA account to a member of Matomo's support team it will provide a quicker resolution.
Here’s a screenshot of the full status of the Google Analytics import:
The message has told me to reach out via the forums, so here I am I’m also fine with sharing my Google Analytics account with a member of the Matomo team.
Thanks for the hint! Just re-authorizing was not sufficient in my case, but I have now created a second OAuth client for Matomo. That seems to have worked for now; let’s see if it continues to work this time.
I have received the following suggestion from Matomo support now:
Generate a new refresh token (existing one is most likely revoked) as described in this SO post
Go to the security tab of your google account dashboard
Under the Recent security activity section, you should see a security alert for your app. (Note: for me, this was not under the Recent security activity section but rather under a section titled something like “Security issues with your account”)
Click on the context menu next to the notification and click DISMISS
At this point you’ll be presented with a dialog of options where you indicate the level of trust you have for the app. I just went ahead and said I trusted the developer/app, obviously. And that’s it! The refresh token should persist after this.