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

Viewed 7305

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.

3 Answers

In development, I was able to reset the exponential cool down by removing the g_state cookie.

One method for this might be to add a development-only "Clear Google One Tap Cookie" link that run an server-side action to remove the g_state cookie and then redirect back to the previous page.

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.

Individual user accounts may globally opt-out of using One Tap from their Google Account settings page. In this case opt_out_or_no_session will be returned.

You'll not be able to force users to use One Tap if they've opt out globally or if the exponential cooldown is active.

During development, on your account, you can follow the suggestions in the Answers to reset the cooldown.

Related