This page describes how to implement features related to users signing in or out with One Tap.
Sign in users automatically
Google One Tap supports automatic sign-in. If there's only one Google session has approved your website, the ID token for that session will be returned automatically without any user interaction.
Automatic sign-in makes the returning user sign-in UX more smooth. Also users don't need to remember which Google account has been selected before for your website. Thus, it's less likely to create unnecessary duplicate accounts on your websites due to different accounts being selected.
To enable automatic sign-in, add
data-auto_select="true" to your code, such as
in the following snippet:
<div id="g_id_onload" data-client_id="YOUR_GOOGLE_CLIENT_ID" data-auto_select="true" data-login_uri="https://your.domain/your_login_endpoint"> </div>
When a user signs out of your website, they can be directed to a page in which a One Tap prompt is automatically displayed. In this case, auto selection must be prohibited. Otherwise, the user is automatically signed in again, which leads to a dead loop user experience (UX).
You need to add the class name
g_id_signout to all of your logout
links and buttons. See the following code snippet:
<div class="g_id_signout">Sign Out</div>
Consequently, the signed-out status is recorded through a cookie in your domain so that the dead-loop UX is avoided.