prompt momentListener is not triggering when use_fedcm_for_prompt is true

164 Views Asked by At

We are using Google One Tap prompt to signup/signin with Google account and initializing it as per the documentation. However, the momentListener is not triggering when use_fedcm_for_prompt is true but works fine if use_fedcm_for_prompt is false.

The GSI client library: https://accounts.google.com/gsi/client

We have below code:

google.accounts.id.initialize({
    callback: handleCredentialResponse,
    cancel_on_tap_outside: false,
    client_id: `<client_id>`,
    itp_support: true,
    use_fedcm_for_prompt: true,
});

google.accounts.id.renderButton(
    gsiButton.current as HTMLDivElement,
    renderGoogleButtonOptions
);

google.accounts.id.prompt((promptNotification) => {
    console.log('prompt callback', promptNotification);
});

In above code, the google.accounts.id.prompt's momentListener is never triggered. But disabling use_fedcm_for_prompt triggers the momentListener.

I found below notes in documentation.

Note: To improve user privacy, display moment notifications are intentionally delayed when FedCM is enabled. Notifications can be received up to 1 minute after the actual event took place.

Note: For the native credential manager, there is no notification for display, skipped, or dismissed moments as these occur outside of the GIS library.

Not sure whether the takeaway is momentListener never gets triggered or triggered after a delay. I waited 10mins after the One Tap popup is shown and still the momentListener wasn't called.

Any ideas on how to get this working?

1

There are 1 best solutions below

1
Chris Harrington On

Not sure if it gives any hints, but look at FedCM get() rejects with AbortError: The request has been aborted

I am studying FedCM today and came upon your post here and also the above post.