Error in import-google-analytics to matomo onpremise

Hi,
I have setup the import of google analytics data to my matomo onpremise as per the guidelines here : https://matomo.org/faq/general/set-up-google-analytics-import/

After scheduling, it ran well for import did work well for 30 minutes and after 30 minutes when I refresh the page, I got this error message, may I know the reason ? Not sure, if I did some mistake. It imported from 2020-01-01 till 2021-06-06 and all in sudden I see this error :

===========================================================
errored

Error message: Error on day 2021-06-07, { "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See "link", "errors": [ { "message": "Invalid Credentials", "domain": "global", "reason": "authError", "location": "Authorization", "locationType": "header" } ], "status": "UNAUTHENTICATED" } }
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](https://forum.matomo.org/). If you can provide access to your GA account to a member of Matomo's support team it will provide a quicker resolution. 
===================================================================

I again reconfigured the importer and did the same, again it ran imported the data for some days and all in sudden the same error occurred. Please advice what to do.

I have the same issue. can anyone help? or is there a possibility to simply skip this one day?

Can you check on your Google account if the token is still valid? Or may have been revocated?

seems to work again. i found the same solution in a different thread. I will check tomorrow again if it’s still running. thank you!

@sureshs, did you fix your issue?

No @heurteph-ei , it is still failing when I see the next day. It runs for few minutes and imports the data for couple of days from google analytics, after some times when I see the page shows the same error. The thing is I again have to re run the script without changing anything in google console.

What do you see in your Google account (about the token)?

This is the error from matomo : errored

Error message: Error on day 2022-02-20, { “error”: { “code”: 401, “message”: "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", “errors”: [ { “message”: “Invalid Credentials”, “domain”: “global”, “reason”: “authError”, “location”: “Authorization”, “locationType”: “header” } ], “status”: “UNAUTHENTICATED” } }
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.

Token from Google is showing the same, nothing changes. The strange thing here is, it ran and imported again few months data to matomo.

Hi @sureshs can you please try to re-authenticate the token and let us know how it goes please.

Hi @V.K same repeated, I revoked the token again from google console, re-authenticated at matomo and resume the import where it stopped, I get the same error, it ran and imported the data for 3 more months until may-22 and stopped with the same error :

errored

Error message: Error on day 2022-05-25, { “error”: { “code”: 401, “message”: "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", “errors”: [ { “message”: “Invalid Credentials”, “domain”: “global”, “reason”: “authError”, “location”: “Authorization”, “locationType”: “header” } ], “status”: “UNAUTHENTICATED” } }
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.

Hi there, did you happen to find a solution?