Security

How to Set Up Two-Factor Authentication (Google, GitHub, Apple)

To set up two-factor authentication, open the account's security settings, turn on 2-step or two-factor authentication, choose a second step such as an authenticator app, passkey or security key, and save the recovery codes it offers. The menu names differ by service, so this guide gives the exact path for Google, GitHub and Apple, and the same pattern applies almost everywhere else.

Setup takes a few minutes per account. The one step people skip is the last one, saving recovery codes, and it is the step that decides whether a lost phone is an inconvenience or a lockout.

Before you start

  • Know which account you are protecting and sign in to it on a computer, where the menus are easiest to follow.
  • Decide on the second step first (see the next section). If you pick an authenticator app, install it on your phone before you open the settings page.
  • Have somewhere safe to put recovery codes: a password manager entry or a printed page. How password managers work explains what a vault protects.

Which second step to choose

All of these count as a second step, but they are not equally strong. As of November 2026, Google's help page lists these options:

MethodHow it worksNotes from the vendor
PasskeyYour device's fingerprint, face scan or screen lockGoogle: signing in with a passkey skips the second step
Hardware security keyA small physical device you connect to your computer or phoneYou confirm it's you by using the key
Authenticator appA 6-digit code that changes every 30 secondsWorks without internet or mobile service
Google promptsA push notification on a signed-in phoneGoogle recommends it if you don't use a passkey
Phone numberA 6-digit code by text or voice callGoogle: the most vulnerable option to phone-based attacks

NIST's authentication guidelines explain the ranking. They say one-time codes and out-of-band messages are not phishing-resistant, because someone typing a code into a fake site hands it to the attacker. Phishing resistance needs cryptographic authentication, which is what passkeys and security keys provide. NIST also lists delivery over the phone network (SMS and voice) as a "restricted" method. For most people the practical order is: passkey or security key if offered, authenticator app next, SMS last. How two-factor authentication codes work covers how app codes are generated.

How to set up two-factor authentication on a Google Account

  1. Go to your Google Account at myaccount.google.com.
  2. Select Security & sign-in.
  3. Under How you sign in to Google, choose Turn on next to 2-Step Verification.
  4. Follow the on-screen prompts to add your second step.
  5. Add a backup option, such as backup codes. Google's backup codes are eight digits each.

Google notes that if the account comes from work, school or another organization, these steps may not work and your administrator controls the setting. A phone number you newly add can take up to 7 days to be trusted.

How to set up two-factor authentication on GitHub

GitHub documents the authenticator-app route in detail:

  1. Install a TOTP (time-based one-time password) app on your phone or desktop. GitHub does not require a specific one.
  2. Click your profile picture in the upper-right corner, then Settings.
  3. In the Access section of the sidebar, click Password and authentication.
  4. In the Two-factor authentication section, click Enable two-factor authentication.
  5. Under Scan the QR code, scan the code with your app. If you can't scan, click setup key and enter the secret by hand.
  6. Type the six-digit code your app shows under Verify the code from the app.
  7. Under Save your recovery codes, click Download and store the file somewhere secure.
  8. Click I have saved my recovery codes to finish.

If your app has no QR scanner, GitHub gives these manual settings: type TOTP, issuer GitHub, label GitHub:<username>, the default SHA1 algorithm, 6 digits and a 30-second period. A security key can be added afterwards, but you must already have 2FA enabled with an app or SMS. GitHub also supports text messages, though it strongly recommends an app because SMS can be intercepted and isn't available in every country.

How to set up two-factor authentication on an Apple Account

  • iPhone or iPad: open Settings, tap your name, choose Sign-In & Security, and turn on two-factor authentication.
  • Mac: open System Settings and follow the same path.
  • Web: you can also turn it on at account.apple.com.

Apple sends the six-digit verification code to your trusted devices or to your trusted phone number. Apple's page says that if your account was created with two-factor authentication, the protection can't be removed, and that a recent enrollment can be reversed within two weeks.

How to set up two-factor authentication on any other service

Most sites follow the same pattern even though the labels change.

  1. Sign in, then open the account menu and look for Security, Account settings or Login & security.
  2. Find the entry named Two-factor authentication, 2-Step Verification, Multi-factor authentication or Two-step login.
  3. Choose Authenticator app (sometimes called "TOTP"). Scan the QR code or enter the setup key.
  4. Enter the current 6-digit code to prove the app is paired.
  5. Save the recovery codes the service shows. They are usually displayed once.

If a service only offers SMS, use it: a text code is still better than a password alone. Switch to an app or key later if the service adds one.

What to do right after setup

  • Store the recovery codes away from your phone. A password manager entry or a printout works. If they are in a file on the same phone as your authenticator, losing the phone loses both.
  • Add a second method. A second device, a second security key, or a passkey on another device means one lost phone doesn't lock you out.
  • Test it. Sign out and sign back in once, so you know the flow works while you still have everything in hand.
  • Check where the codes will go. If your authenticator app only lives on one phone, find out whether the app supports a backup or transfer before you replace that phone.

If setup fails

  • The code is rejected every time. App codes depend on the clock. Check that your phone's date and time are set automatically, then try the next code that appears.
  • You can't scan the QR code. Use the text setup key instead, and type it into the app by hand.
  • The option is missing or greyed out. On work or school accounts the administrator controls it. Ask them, as Google's help page advises.
  • You didn't save the recovery codes. Go back to the same settings page and look for a recovery or backup codes entry. On GitHub that is under Password and authentication.

Frequently asked questions

Which two-factor method should I choose?
Prefer a passkey or hardware security key if the service offers one, then an authenticator app, and use SMS only if nothing else is available. Google describes a phone number as the most vulnerable option to phone-based attacks, and GitHub strongly recommends a TOTP app over text messages.
Do I need to set up two-factor authentication on every account?
Start with the accounts that can reset others: your primary email, your password manager, your Apple or Google account, and anything holding money. An email account matters most because password resets for other services usually go to it.
What happens if I lose my phone after setting up two-factor authentication?
You sign in with a recovery or backup code, a second registered method, or another device that is already signed in. Without any of those you have to go through the service's account recovery process, which is slower. This is why saving recovery codes during setup matters.
Is two-factor authentication the same as two-step verification?
In practice the terms are used interchangeably. Google calls its feature 2-Step Verification and Apple and GitHub call theirs two-factor authentication. The setup idea is the same: after your password, you prove a second thing, such as a code from an app or a tap on a security key.

Sources