1. elisa
  2. RO CSVI
  3. Wednesday, 22 January 2025
  4.  Subscribe via email
Hi!
I have a template which gets contens from Google sheets. But I can't just run the template. I have always to reopen it and re-authenticate (basically save and close) before it can run it.

{ "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" } }

Is there a way to make it work with a cronjob?
Thanks
Accepted Answer Pending Moderation
Hi Elisa,

Logging into your personal Google account should not revoke it as far as I know. As long as you have created an OAuth 2.0 Client ID all should be good. This process is that you authenticate and then you get a refresh token and with the refresh token you can request new access tokens.

The export works if you resave the credentials and run the template through the browser? If you run it from the cron after that, does it give the error immediately? Perhaps you can explain in a bit more detail what actually happens and when you get what error.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hi Roland,
I confirm its in production. I did not change anything about the other settings. Does it revoke the authentication when I log in into my personal Google Account with the browser? is there a conflict then? I can't imagine something like this has to do something with it, but I am really not sure why it does not work.
Elisa
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hi Elisa,

A while ago we had a user whose token would expire as well and that turned out to be a setting in the Google Console.

First to check is the status of your OAuth integration at https://console.cloud.google.com/apis/credentials/consent Here you should see your OAuth consent status and this must be set to published and not testing.

published_status_app.png

That would be the first thing to check and see if it is correct.

There is another document at Google about the expiration of tokens that may be useful:
https://developers.google.com/identity/protocols/oauth2#expiration

Let me know if that helps.
Attachments (1)
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!