Tampermonkey: Google sign in is shown everytime when logged into multiple google accounts

Created on 10 Apr 2020  路  6Comments  路  Source: Tampermonkey/tampermonkey

https://accounts.google.com/signin/oauth/oauthchooseaccount shows up when sync is starting (usually when browser is started), it seems to remember the auth data for like hour or so.

Expected Behavior

This URL should not open each time browser is started.

Actual Behavior

Mentioned URL opens almost every time browser starts.

Specifications

  • Chrome 80.0.3987.163
  • TM: 4.9
  • OS: Win 10 x64

From all extensions I'm using with Google Drive sync only Tempermonkey is having this issues.
(reddit enhanced, stylus)

I've already tried revoking access through the extension and Google Drive (with data wipe) as well as clean installing the extension without any success.

Script

I've tried using this script I found while searching for solution but it doesn't work at all (doesn't show up as active script on that page):

// ==UserScript==
// @name         Sync fix
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *://*.google.com/*/oauthchooseaccount*tampermonkey*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.querySelector('div[data-authuser="0"]').click();
    window.close();
})();

All 6 comments

Remaining scripts working?

Remaining scripts working?

What do you mean? Posted script doesn't work on that page even though it should.

Scripts on other pages.

Everything is working fine on other pages
The issue stopped happening now randomly, I'll close this off for now since there is no way to investigate this currently.

Seems like the issue is back and resetting no longer works, now each time first attempt to authorize shows Google's "something went wrong page" and after clicking "Next" it ends up as "400. That's an error.'.

I was able to get rid of it after repeatedly revoking and resetting sync over and over again until it stopped asking me for auth on browser launch... but the bug is still there so I'm leaving this open.

Currently using this workaround script (it automatically clicks first account):

// ==UserScript==
// @name         Google Drive sync fix
// @version      0.1.0
// @author       jacklul <jacklul.github.io>
// @match        https://accounts.google.com/signin/oauth*tampermonkey*
// ==/UserScript==

(function() {
    'use strict';

    let tryClick = setInterval(function() {
        const el = document.querySelector('div[data-authuser="0"] #profileIdentifier');

        if (el) {
            const isBusy = document.querySelector('div[role="presentation"][tabindex="-1"]');
            const hasBackButton = document.querySelector('div[role="button"]#next');

            if (isBusy) {
                console.log('Page is busy...');
            }

            // Close page if there was "unknown error"
            if (hasBackButton) {
                window.close();
            }

            // Try clicking until page gets busy
            if (!isBusy) {
                console.log('Clicking...');
                el.click();
            }
        }
    }, 500);
})();

Thanks @jacklul, that script seems very useful. I have uploaded it here, so it's easy for people to install:

https://openuserjs.org/scripts/joeytwiddle/Tampermonkey_Google_Drive_sync_fix

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotennin picture dotennin  路  3Comments

rychphd picture rychphd  路  7Comments

AlfonsoML picture AlfonsoML  路  4Comments

devnoname120 picture devnoname120  路  7Comments

gituser823 picture gituser823  路  4Comments