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.
google.accounts.id.prompt((notification) => {
if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
document.cookie = `g_state=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT`;
google.accounts.id.prompt()
}
});
this worked for me to delete the cookie and try again
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With