Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Search Console integration breaks after 7 days due to expiring OAuth tokens #4784

Open
2 tasks done
bobsoap opened this issue Nov 6, 2024 · 1 comment
Open
2 tasks done
Assignees
Labels
self-hosting Anything self-hosted

Comments

@bobsoap
Copy link

bobsoap commented Nov 6, 2024

Past Issues Searched

  • I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

Via #690, only that the number of websites set up is not a factor.

The instructions to integrate Google Search Console with Plausible (https://github.com/plausible/community-edition/wiki/google-integration) use an external user type and a publishing status of "Testing" in Google Cloud Platform.

However, it seems that GCP rotates the OAuth token every 7 days in this constellation:

A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days, unless the only OAuth scopes requested are a subset of name, email address, and user profile
via https://developers.google.com/identity/protocols/oauth2

Thanks to @mheland for finding this out.

Following these instructions gives us Google Search Console keywords for max. 7 days before the connection fails with error "invalid_grant" due to the expired token. The only remedy is to unlink the Google account and go through the setup process again from scratch, which is extremely tedious.

Perhaps it's possible to refresh the API token every n days (e.g. 6, if keeping track of the date it was added)?

Expected behavior

Once linked, the Google Search Console integration should persist and not expire for good after 7 days.

Screenshots

No response

Environment

- Plausible CE v2.1.1
@ruslandoga ruslandoga self-assigned this Nov 6, 2024
@ruslandoga ruslandoga added the self-hosting Anything self-hosted label Nov 6, 2024
@flipzoom
Copy link

I had the same problem back then. The solution for me was not to leave the app in test mode, but to actually publish it and go live. Since then, the connection has remained intact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-hosting Anything self-hosted
Projects
None yet
Development

No branches or pull requests

3 participants