Bad Request error during Analytics import

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 :slight_smile: I’m also fine with sharing my Google Analytics account with a member of the Matomo team.

I got the same error and could solve it by just authorize again. After this the reauthorization the importing started working again.

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.

A few days later, the error started occurring again for me.

I have received the following suggestion from Matomo support now:

  1. Generate a new refresh token (existing one is most likely revoked) as described in this SO post
  2. Go to the security tab of your google account dashboard
  3. 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”)
  4. Click on the context menu next to the notification and click DISMISS
  5. 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.