Automatic sign-in and sign-out  |  Authentication  |  Google for Developers (2024)

Chrome third-party cookie deprecation starts Q1 2024. Follow the migration guide to review potential changes and avoid negative impacts for user sign-in to your website.

  • Home
  • Products
  • Google Identity
  • Authentication
  • Sign In with Google for Web
Stay organized with collections Save and categorize content based on your preferences.

This page describes how to implement features related to how users sign in orsign out with Google One Tap.

Sign in users automatically

Google One Tap supports automatic sign-in, which provides a frictionless userexperience (UX) by removing the manual steps visitors must take when returningto your site. Users don't need to remember which Google Account they selectedduring their last visit, decreasing the chances of unnecessary duplicateaccounts being created on your platform.

Automatic sign-in is intended to complement our Sign in with Google buttonand One Tap dialogs. It is designed to be used across your entire site, withmanual sign-up or switching accounts occurring only after the user has firstsigned-out of your site.

For Automatic sign-in to occur the following conditions are required:

  • users must first be signed-in to their Google Account, and
  • previously granted consent to share their account profile with your app, and
  • when using FedCM, made only a single sign-in attempt in the last 10 minutes.One Tap is displayed when repeated sign-in attempts occur during this window.
  • when using FedCM, Chrome requires users to reconfirm that they want tosign in to the website with Google Account in each Chrome instance even if theuser approved the website prior to the FedCM rollout. This change may affectconversion rate on your existing site using One Tap. In Chrome M121 update,Auto Sign-in improvement mitigates conversion rate drop issue.

For pages where Automatic sign-in is enabled and if these conditions are metthe visitors ID token credential is automatically returned without any userinteraction. If these conditions are not met, and even if Automatic sign-in isenabled on the page, the user defaults to the One Tap flow for sign-in orconsent. If a user has multiple Google Accounts and visits your site they arerequired to first sign-in to a single Google Account and to have providedconsent for that account.

You may measure Automatic sign-in success rate using the auto value in theselect_by field of the returned credential object.

To enable automatic sign-in, add data-auto_select="true" to your code, asshown in the following snippet:

<div id="g_id_onload" data-client_id="YOUR_GOOGLE_CLIENT_ID" data-login_uri="https://your.domain/your_login_endpoint" data-auto_select="true"></div>

Sign out

When a user signs out of your website, they can be directed to a page where aGoogle One Tap prompt is automatically displayed. For this setup, auto-selectionmust be prohibited. Otherwise, the user is automatically signed in again, whichleads to a dead-loop UX.

Using FedCM

To improve user experience, there is a 10 minute quiet period between everyautomatic sign-in attempt. During this time period, One Tap prompt isdisplayed instead. Users need to explicitly click One Tap to sign in.

Without FedCM

To prohibit auto-selection after a user signs out, add the class nameg_id_signout to all of your logout links and buttons. See the following codesnippet:

<div class="g_id_signout">Sign Out</div>

The following JavaScript code snippet can also be used for sign out:

const button = document.getElementById('signout_button');button.onclick = () => { google.accounts.id.disableAutoSelect();}

Consequently, the signed-out status is recorded through a cookie in yourdomain so that the dead-loop UX is avoided.

The sign-out status is stored into the g_state cookie in your domain. If youhave a service that monitors all of the cookies used in your domain, you needto notify them of this cookie.

If you don't want to load the client library on your post-login pages, usethese solutions to prevent a dead-loop UX after log out occurs:

  • On log out, redirect users to a page (say,https://example.com/logged_out) where One Tap is not displayed, orwhere auto sign-in is always disabled.
  • On log out, add a parameter to the URL. For example, logged_out=1.When rendering One Tap by JavaScript API, check that URL parameter anddisable auto sign-in when present.

Key user journeys

The automatic sign-in page.

Using FedCM

Automatic sign-in and sign-out | Authentication | Google for Developers (1)

Users can close the One Tap prompt by clicking the X button. Foraccessibility consideration, an ID token is shared with your websiteeven if users click the X button.

To improve user experience, there is a 10 minute quiet period between everyautomatic sign-in attempt. During this time period, One Tap prompt isdisplayed instead. Users need to explicitly click One Tap to sign in.

Without FedCM

Automatic sign-in and sign-out | Authentication | Google for Developers (2)

If users don't click the Cancel button within 5 seconds, an ID tokenis shared with your website.

When Sign-In is cancelled, based on the number of active Google sessions,either the account chooser page or the returning user page displays.

  • Multiple Google sessions

Automatic sign-in and sign-out | Authentication | Google for Developers (3)

  • Single Google Sessions

Automatic sign-in and sign-out | Authentication | Google for Developers (4)

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-05-01 UTC.

Automatic sign-in and sign-out  |  Authentication  |  Google for Developers (2024)

FAQs

Why is Google constantly asking me to sign in? ›

If Google keeps signing you out when you'd rather stay logged in, here are a few tips: Make sure your cookies are turned on. Some antivirus or related software may delete your cookies. If your cookies are turned on, clear your browser's cache.

How do I make my Chromebook sign in automatically? ›

  1. On your computer, open Chrome.
  2. At the top right, select Profile Passwords . If you can't find your Google Account, learn how to turn on sync in Chrome. If you can't find the Passwords icon, at the top right, select More ​​​​​ Passwords and autofill. ...
  3. On the left, select Settings.
  4. Turn Sign in automatically on or off.

Why does Google sign me in automatically? ›

Users don't need to remember which Google Account they selected during their last visit, decreasing the chances of unnecessary duplicate accounts being created on your platform. Automatic sign-in is intended to complement our Sign in with Google button and One Tap dialogs.

What is the difference between Google authentication and authorization? ›

Authorization identifies what resources the requestor can access and what level of access that they have. Authentication is a prerequisite for authorization. You can't determine what resources to access without first establishing the identity of the requestor.

How do I stop Google from prompting me to sign in? ›

To turn off sign in prompts in your Google account, go to your Google Account security page and sign in to your account. Once you're signed in, on the Security page under the "Signing in to Other Sites" section turn off the "Google Account sign-in prompts" option.

Can I get Google to stop asking if I want to sign in? ›

Go to myaccount.google.com, navigate to Security > See All Connections, then click the gear icon. Disable the toggle next to "Google account Sign-in Prompts" to remove sign-in prompts from websites. Certain websites show a "Sign in with Google" prompt to help you quickly sign in to that website.

Why does my Chromebook keep making me sign-in? ›

If Google keeps signing you out, here are some steps you can try: Make sure cookies are turned on. Some antivirus or related software may delete your cookies. If your cookies are turned on, clear your browser's cache.

How do I skip Chromebook sign-in? ›

To turn on guest browsing:
  1. If you're signed in as a guest, sign out.
  2. Sign in to your Chromebook using the owner account.
  3. At the bottom right, select the time.
  4. Select Settings .
  5. Under "Privacy and security," select Manage other people.
  6. Turn on Enable Guest browsing.

How do I remove autologin? ›

How To Disable Automatic Login:
  1. Step 1: Press Win+R, enter “netplwiz“, which will open the “User Accounts” window. ...
  2. Step 2: On the “User Accounts” window, select the user account and check the option for “Users must enter a username and password to use this computer” and then click Apply.

How do I change my Google auto login? ›

Manage auto sign-in
  1. On your Android phone or tablet, open your device's Settings app.
  2. Tap Google. Manage your Google Account.
  3. In the menu, tap Security.
  4. Scroll down to "Signing in to other sites."
  5. Tap Password Manager. Settings .
  6. Turn Auto sign-in on or off.

How to automatically login? ›

What to Know
  1. Open the Advanced User Accounts program by entering the netplwiz command in the Run dialog box.
  2. In the User tab, uncheck Users must enter a user name and password to use this computer. Select OK.
  3. Enter the username and password for the automatic login. Select OK to save. Restart your computer.
Dec 18, 2022

Where is the Google Developer Console? ›

The developer dashboard is located here https://play.google.com/apps/publish/ (login to your google account). For more information about a specific app, click on Comments, Statistics or Errors.

Which is better authentication or authorization? ›

You cannot have a secure solution unless you have configured both authentication and authorization correctly. Authentication is verifying the true identity of a user or entity, while authorization determines what a user can access and ensures that a user or entity receives the right access or permissions in a system.

Is Google authentication safe? ›

By signing up and in with Sign in with Google, you're safe from bad actors stealing your passwords for third-party apps and services. Even if an app or service has a security incident, Sign in with Google continues to protect you by uniquely verifying each login.

How do I stop Google from asking me to sign in on my iPhone? ›

Turn off 2-Step Verification
  1. On your iPhone or iPad, open the Gmail app . At the top right, tap your profile picture or initial. ...
  2. At the top, tap Security.
  3. Under "How you sign in to Google," tap 2-Step Verification.
  4. Select Turn off.
  5. A pop-up window will appear to confirm that you want to turn off 2-Step Verification.

Why do I keep having to sign into Google on my iPhone? ›

It looks like you're having a prompt to agree and sign in to your Google account and we want to help. From what you are showing, you are using private browsing on your iPhone. Private browsing isn't going to accept cookies, so you will need to turn that off first.

Why does the browser keep asking for username and password? ›

These multiple authentication requests cause the Web browser to interpret that the credentials are incorrect. Therefore, the user is prompted again for credentials. Users may be prompted to type credentials many times if the Web browser opens several connections.

Top Articles
Latest Posts
Article information

Author: Tish Haag

Last Updated:

Views: 6176

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tish Haag

Birthday: 1999-11-18

Address: 30256 Tara Expressway, Kutchburgh, VT 92892-0078

Phone: +4215847628708

Job: Internal Consulting Engineer

Hobby: Roller skating, Roller skating, Kayaking, Flying, Graffiti, Ghost hunting, scrapbook

Introduction: My name is Tish Haag, I am a excited, delightful, curious, beautiful, agreeable, enchanting, fancy person who loves writing and wants to share my knowledge and understanding with you.