Jason Cipriani/CNET

Whether you just picked up a new iPhone SE, Samsung Galaxy A51, or any other phone, one of the first things you should do -- after you've processed the initial rush of excitement -- is an important task that will help keep your phone secure and in smooth, working order. Transfer the accounts being used by your Google Authenticator app so you can access your two-factor codes on your new device. Otherwise, you may find yourself unable to log into some of your online accounts.

Two-factor authentication (2FA) adds an extra layer of security to your online accounts by requiring a randomly generated six-digit code after you've successfully entered your password. As privacy concerns continue to rise amid breach after breach, two-factor authentication is increasingly recommended as a way to help fortify your online security by making it harder for others to log in as "you."

Most websites give you the option to receive your 2FA codes through SMS texting or using a dedicated app like Google Authenticator, but we don't recommend using SMS. Hackers have had a lot of success tricking wireless carriers into switching the SIM card associated with a person's phone number and in turn, receive the two-factor codes sent to the actual user's phone number. Twitter CEO Jack Dorsey is a prime example.

Google recently updated the Android version of its Authenticator app, the first update in a few years. It adds a fancy new transfer tool that removes the painstaking process of individually moving your accounts between your old and new phones, which makes moving your 2FA codes simpler than ever. We'll also explain how to do this on an iPhone.

Now playing: Watch this: Turn on two-factor authentication to protect your accounts

Android users have it easy

If you're switching from one Android phone to another, make your life easier by using the new transfer tool. Make sure you have the latest version of Authenticator on your old phone by checking for updates in the Play Store. Of course, you'll need to have Authenticator installed on your new phone, too.

Juan Garzon / CNET

Then follow these steps on your old phone:

1. Open Authenticator then tap the three-dot menu icon followed by Transfer accounts.

2. Select Export accounts and enter your PIN code when prompted.

3. Pick the accounts you want to transfer then tap Next.

Jason Cipriani/CNET

On your new phone:

1. Open Authenticator, tap Get Started,

2. Tap Import existing accounts? located at the bottom of the screen.

3. Select Scan QR code.

Your old phone may have just one or multiple QR codes for you to scan. Follow the prompts to finish the transfer process. You'll see a confirmation prompt for each successful transfer.

Lexy Savvides/CNET

iPhone users have to do some extra work

Google hasn't updated the iPhone Authenticator app with the same transfer process yet, so you'll need to use the old school method of manually transferring your Authenticator accounts, one by one. Here's what you'll need to do:

1. Install Authenticator on your new iPhone.

2. On your computer, visit Google's two-step verification site and log in to your Google account.

Screenshot by Jason Cipriani/CNET

3. Click Change Phone in the Authenticator app section. Select the type of phone you'll be using and follow the prompts. If you want to disable Google Authenticator altogether, click on the trash can icon and confirm your decision. Google will then revert to delivering your 2FA codes via SMS.

4. Open the Authenticator app on your new phone and tap Begin > Scan barcode. Scan the QR code displayed on Google's website with the Authenticator app, then enter the six-digit code to verify everything is working properly. Once that's done, the codes on your old device will no longer be valid.

Repeat this process for each service you currently use with Google Authenticator, be it Apple, Facebook, Dropbox, or Amazon. Don't delete the Authenticator app off your old phone until you've moved all accounts to your new phone, otherwise, you'll be locked out of those accounts -- and nobody wants that.

Now that you've transferred Google Authenticator to your new phone, take some time to learn all of the iPhone's hidden features or master Android's hidden features. Still trying to figure out what to do with that old phone? We have some suggestions for iPhone and Android alike.