Search code examples
javascriptasp.net-mvcoauth-2.0google-signingoogle-authentication

Google One tap sign-in UI not displayed after clicking the close button


I am trying to make the new google one tap sign in work following this guide:

https://developers.google.com/identity/one-tap/web

google.accounts.id.initialize({
            client_id: '123123123123123123.apps.googleusercontent.com',
            cancel_on_tap_outside: false,
            callback: handleCredentialResponse
        });

        //google.accounts.id.prompt(true);

        google.accounts.id.prompt((notification) => {
            if (notification.isNotDisplayed() || notification.isSkippedMoment()) {

                // continue with another identity provider.
            }
    });

I am using the One Tap JavaScript API to display One Tap. And it perfectly does what it needs to do.

Client side verification and all works well but I've got one problem. After I close the UI by clicking the close button at the top right corner of the window, the UI is not displayed anymore and when I examine the notification status it shows me this error;

opt_out_or_no_session

What do I need to do to keep the UI displayed even if it's closed by the user? I appreciate any help.


Solution

  • This is the so-called "Exponential Cool Down" feature. More details at https://developers.google.com/identity/one-tap/web/guides/features#exponential_cool_down.

    Google One Tap is an optimized UX for users to sign-in or sign-up with just one tap. If a user doesn't want to sign-in/sign-up (by closing the One Tap), it should not be displayed again and again on each page reloading or navigation. To most users, it's an annoying UX. With the cool down feature, users won't feel to be pushed to sign-in/sign-up.