Blog / How the internet works /

How login with Google works

You click “Continue with Google”, a window flashes up, you tap your account, and you’re in. No new password, no email confirmation. It feels like the website magically knows you. What actually happens is more careful, and understanding it tells you when the button is safe to trust.

The idea in one line

You prove who you are to Google, and Google tells the website, “yes, this person is who they say.” The website never sees your Google password.

Think of a nightclub that accepts a government ID. The club doesn’t make its own ID cards. It trusts the issuer. You show the ID at the door, the bouncer checks it’s real and lets you in. The club learns your name and age, not your home address, unless the ID shows it.

The technology: OAuth and OpenID Connect

Two standards sit behind most “sign in with” buttons.

OAuth 2.0 is a way for one service to give another limited access to something, without handing over a password. It’s the thing that lets an app read your calendar but not delete your email.

OpenID Connect sits on top of OAuth and adds identity: a standard way of saying “this is who just signed in.” Google’s sign-in uses it.

What happens when you click

Here is a simplified version of the flow.

  1. You click the button on the website. The site sends your browser to Google’s sign-in page, with a note about who is asking and what it wants to know (typically your name, email address and profile picture).
  2. You sign in to Google, if you aren’t already, and see a consent screen listing what the site is asking for.
  3. You approve. Google sends your browser back to the website, carrying a short-lived one-time code.
  4. The website’s server swaps the code for tokens. It talks directly to Google, proving its own identity with a secret that only it knows. Google returns an ID token, which says who you are, and sometimes an access token for particular permissions.
  5. The site checks the token and creates a session for you. You’re logged in.

The important details are the code and the secret. Your password never leaves Google. The site gets a signed statement, not your credentials. And because the code travels through your browser while the exchange happens server to server, an eavesdropper on your browser doesn’t get the valuable part.

What the site learns

Usually: your name, email address and profile photo, plus a stable account identifier. It can ask for more, such as calendar access, but each extra permission should show up on that consent screen. Read it. If a simple blog asks for access to your Drive, say no.

Why sites offer it

  • Fewer forgotten passwords. Lower friction at sign-up usually means more people finish.
  • Less password storage. The site isn’t holding a database of passwords to be leaked.
  • Better security by default. Google’s own sign-in checks and any two-step verification you have switched on carry over.
  • Verified email addresses. The site knows the address belongs to you.

The trade-offs

  • One account to rule them all. If someone takes over your Google account, they may reach every site where you used the button. Turn on two-step verification and see Google account security on Android for a checklist.
  • Lock-in. If you lose access to that Google account, you may lose access to the sites you signed into with it. Some sites let you add an alternative password or email later. It’s worth doing while things work.
  • Tracking. Google learns which services you use. That’s a privacy choice, and you can make it either way.
  • Email changes. If you change your Google email, some sites keep the old one.

You can see and remove the apps with access in your Google account’s security settings. It’s worth a clean-up now and then.

If you run a website

Adding Google sign-in to a site is common on WordPress, with plugins, and in custom apps, with Google’s libraries. Some things matter:

  • Use a trusted library or plugin. Don’t write the token checks yourself.
  • Register the exact redirect addresses with Google, and keep them strict. A loose setting here is a classic source of vulnerabilities.
  • Ask for the minimum. Name and email are usually enough. Each extra permission lowers trust and raises your responsibility.
  • Offer a fallback. Some people don’t have or don’t want a Google account. Email sign-in alongside the button is kinder.
  • Verify the token properly on the server, including who issued it and who it was meant for.
  • Mind privacy rules. You’re now handling personal data. Say so in your privacy policy.

If you’re building something with AI help, check the sign-in code carefully, since security mistakes are easy to generate and hard to spot. I wrote about this in security basics for AI-built web apps.

Key takeaways

  • “Sign in with Google” lets Google vouch for you, so the site never sees your password.
  • It uses OAuth 2.0 and OpenID Connect; a one-time code is swapped for tokens behind the scenes.
  • Read the consent screen: the site should ask for as little as possible.
  • Your Google account becomes a master key, so protect it with two-step verification.
  • Site owners should use proven libraries and strict redirect settings.

Open your Google account’s list of connected apps. How many do you still use?