Google One Tap doesn't work on IOS and mac Safari. Failed to open popup window

231 Views Asked by At

Google one tap doesn't work on IOS browsers and mac Safari. Google chrome, FF, android browsers etc are working fine.

Error: [GSI_LOGGER]: Failed to open popup window on url: https://accounts.google.com/o/oauth2/v2/auth?{queryParams}. Maybe blocked by the browser?

Script:

<script
      type="text/javascript"
      src="https://accounts.google.com/gsi/client"
      defer
      data-testid="gsi-client-script"
/>

Code:


    window.google.accounts.id.initialize({
      client_id: publicRuntimeConfig.socials.google.auth.id,
      callback: ({ credential }) => {
        const user = decodeJwt(credential);
        if (user.email_verified) {
          const client = window.google.accounts.oauth2.initTokenClient({
            client_id: user.aud,
            scope: 'https://www.googleapis.com/auth/userinfo.profile',
            hint: user.email,
            prompt: '',
            callback: ({ access_token: password }) => {
              // function is not called
            },
          });
          client.requestAccessToken(); // Error is happened after calling this
        }
      },
    });

    window.google.accounts.id.prompt();
0

There are 0 best solutions below