'How to close the One-Tap hint when user logs in with another method?

I managed to implement the relatively new One-Tap sign-up/sign-in flows, following the get started guide here. I also have other login methods working on the same project (facebook login and email/password login). When the user logs in using one of these other methods, the One-Tap hint inviting the user to login with Google stays there, in the middle of my logged-in experience, as the hint was added to the page before the user was identified. In my login flow, I don't reload the page. I just replace/show/hide stuff on it. How can I close that Google invitation when the user decides to login with another method?



Solution 1:[1]

you can call this method, source

googleyolo.cancelLastOperation().then(() => {


// Credential selector closed.

});

Solution 2:[2]

This has changed to the following -

google.accounts.id.cancel();

Sign In With Google JavaScript API reference  |  Google Developers

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wen W
Solution 2 Josh Unger