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-Auth shows Blank popup after clicking on "Not Now" on Suggestions Screen #1189

Open
boltcoder opened this issue Jan 23, 2024 · 9 comments

Comments

@boltcoder
Copy link

Summary
My Google Auth flow in popup window works for most of the google users who have completed their profiles and have added recovery options.
For some of the users who haven't completed their google profile, the following Suggestions screen come up:

Profile Suggestion Please notice the url in the popup window is now https://gds.google.com (and earlier it was accounts.google.com).

Upon clicking on "Not Now",
Not Now

The auth flow breaks and Blank Screen appears. Please notice that we're being redirected from gds.google.com to accounts.google.com

Screenshot 2024-01-23 at 2 41 06 PM

The error trace in the browser's console is
Cannot read property ‘postMessage’ of undefined

I feel the popup lost it's reference to my website's window in that redirection from accounts.google.com to gds.google.com

My webapp has the header Cross-Origin-Opener-Policy: same-origin-allow-popups set.

Screenshot 2024-01-23 at 2 44 52 PM

Browser(s)/Version(s)
All browsers

Expected Behavior
After clicking on "Not Now" in the Suggestions should continue to authenticate and call the callback registered in the initialize statement. window.google.accounts.id.initialize({callback})

Actual Behavior
After clicking on "Not Now" in the Suggestions screen, popup goes blank and browser gives the following error in console
Cannot read property ‘postMessage’ of undefined

@boltcoder
Copy link
Author

Any suggestions here?

@jankrynauw
Copy link

do you have any details to share on the auth setup within your app?

@boltcoder
Copy link
Author

@jankrynauw Yes.
I have a react application on [email protected].
It's a client side rendered application.

Google scripts are loaded asynchronously after pageLoad event,

<Script
src="https://accounts.google.com/gsi/client"
        strategy="afterInteractive"
/>

Then when our Login Component is loaded, we wait for the parent div element's to be mounted before calling initialize and rendering the button.

const [googleSecureSignInRef, setGoogleSecureSignInRef] = useState(null);


useEffect(() => {
    if (googleSecureSignInRef && window.google) {
      window.google.accounts.id.initialize({
        client_id : config.GOOGLE_CLIENT_ID,
        callback  : onAuthenticationResponse,
      });
      window.google.accounts.id.renderButton(googleSecureSignInRef, {
        theme          : 'outline',
        size           : 'large',
        type           : 'standard',
        shape          : 'pill',
        logo_alignment : 'center',
        width          : 300,
        height         : '54',
      });
    }
  }, [googleSecureSignInRef, window.google]);

  return (

      <div
        className={className}
        ref={setGoogleSecureSignInRef}
      />

  );

@boltcoder
Copy link
Author

any suggestions please?

@rafaelpazl
Copy link

I have the same problem. I'm trying here, rereading the Google documentation. Anything I find, I'll post it here, bro!

@boltcoder
Copy link
Author

Any suggestions !??

@boltcoder
Copy link
Author

can anyone please suggest something?

@nishant-panwar-velotio
Copy link

Anyone got anything?

@boltcoder
Copy link
Author

anyone has anything here? Please?

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

No branches or pull requests

4 participants