Import google auth

Import google auth DEFAULT

Two-factor authentication (2FA) is one of the best and easiest ways to keep your online accounts secure. It works by issuing an authentication code on your phone when somebody tries to access the account; if that person doesn’t have the code, they (or you) don’t get in. By using a 2FA app, such as Google Authenticator or Authy, you can prevent somebody from accessing your data by getting your password. (You can have a code texted to you, but that is considered far less secure due to the rise of so-called SIM hacking.)

There is, of course, a catch. Because 2FA uses a key specific to your phone, if you lose or break your phone, you can’t simply reinstall the app on your new phone and go on from there. You need to transfer the key code for that phone as well as the app itself.

Different authentication apps handle this in different ways. In this article, I’m going to look at Google Authenticator, including the easiest way to transfer the app to a new phone if you do have access to the old one, and how you can prepare for a possible problem (like a broken phone).

Google Authenticator lets you establish 2FA by using your phone to scan a QR code generated by the app on a separate device or by entering a key code. It’s a relatively easy process — unless you find you have to move the app to a new phone.

Because 2FA uses security keys that are specific to each piece of hardware, you can’t simply reinstall Google Authenticator on your new phone and use it to log in. Instead, you have to transfer the keys to your new app.

The easiest method, especially if you use 2FA with several apps, is to use the Authenticator app’s dedicated transfer feature to move your keys from one phone to the other. However, there are two assumptions here: first, that you have access to both the old and new phone, and second, that you have Android devices. If either of these assumptions doesn’t work for your situation, there are other methods you can use, which we’ll cover next. But first, the easy method.

Transfer your Authenticator keys via Android

If you’ve got two Android phones, you can transfer your accounts to a new phone by exporting them via a QR code generated by the Authenticator app.

  • Install Google Authenticator on your new phone.
  • Tap “Get started.”
  • Tap “Scan a QR code.” You’ll get a grid and instructions to “Place QR code within red lines.”
  • Open Google Authenticator on your older phone.
  • Tap on the three dots on the top right of the screen and select “Transfer accounts”
  • Select “Export accounts.” You may be asked to verify your identity via a fingerprint, password, or another method.
  • Uncheck which accounts you don’t want to export. Tap “Next.”
  • You’ll be shown a QR code. Center it in the grid in your new phone.
  • You should see the imported app now listed in your Google Authenticator app in the new phone. (Note: the app will not be deleted from your old phone.)

Alternative method #1: Use your backup codes

When you first set up Google Authenticator, you may be given a set of backup codes and asked to print them out or otherwise save them. And you definitely do want to save them; print them out and put them somewhere safe or create a PDF and save it where nobody else can access it. If your phone goes south, these codes will be a good way to reestablish authentication on your new phone — assuming, of course, you haven’t misplaced the codes.

This is also the way to reestablish your keys on a new iPhone.

If you missed that step during the installation, you can get those backup codes anyway. For that, you have to go into your Google account and then follow these steps:

  • Click on “Security” in the left-hand column.
  • Scroll down to and select “2-Step Verification.” You’ll probably have to enter your password.
  • Scroll down to “Backup Codes” and click on “Show Codes.”
  • You’ll get a list of 10 codes. Each code can be used once; if you use them all, you can get more by clicking on “Show Codes” and then on “Get New Codes.”

Alternative method #2: Take a screenshot of the barcode

One way to create a backup in case you lose your phone is to take and save a screenshot of the barcode that is created for each 2FA-secured app. If you’ve mislaid your backup codes, but you’ve saved a screenshot of the QR barcode that you originally used to create your app’s authentication, you can use that screenshot to establish your credentials on a new phone.

Just throw the screenshot up on your computer, install Google Authenticator on your new phone, and use the plus sign on the app to scan the barcode. (You can also enter the setup key code if that’s what you saved.) Do this for each of your apps, and you’ll be all set.

Update October 12th, 2021, 11:20AM ET: This article was originally published on September 2nd, 2020; the directions for transferring between Android phones have been updated.


User Guide

Making authenticated requests¶

Once you have credentials you can attach them to a transport. You can then use this transport to make authenticated requests to APIs. google-auth supports several different transports. Typically, it’s up to your application or an opinionated client library to decide which transport to use.


The recommended HTTP transport is which uses the Requests library. To make authenticated requests using Requests you use a custom Session object:



is the underlying HTTP library used by Requests and can also be used with google-auth. urllib3’s interface isn’t as high-level as Requests but it can be useful in situations where you need more control over how HTTP requests are made. To make authenticated requests using urllib3 create an instance of :


You can also construct your own instance and pass it to :



gRPC is an RPC framework that uses Protocol Buffers over HTTP 2.0. google-auth can provide Call Credentials for gRPC. The easiest way to do this is to use google-auth to create the gRPC channel:



Even though gRPC is its own transport, you still need to use one of the other HTTP transports with gRPC. The reason is that most credential types need to make HTTP requests in order to refresh their access token. The sample above uses the Requests transport, but any HTTP transport can be used. Additionally, if you know that your credentials do not need to make HTTP requests in order to refresh (as is the case with ) then you can specify .

Alternatively, you can create the channel yourself and use :

importgrpcmetadata_plugin=AuthMetadataPlugin(credentials,http_request)# Create a set of grpc.CallCredentials using the metadata plugin.google_auth_credentials=grpc.metadata_call_credentials(metadata_plugin)# Create SSL channel credentials.ssl_credentials=grpc.ssl_channel_credentials()# Combine the ssl credentials and the authorization credentials.composite_credentials=grpc.composite_channel_credentials(ssl_credentials,google_auth_credentials)channel=grpc.secure_channel('',composite_credentials)

You can use this channel to make a gRPC stub that makes authenticated requests to a gRPC service:

  1. Hunter biden company
  2. Browning waterfowl guns
  3. Mountain bike tire liner
  4. Young sirius black
  5. L blend poems

Using Two Factor Authentication, or 2FA, is a great way to ensure the security of your Google Account. This added layer of protection uses a mobile device that provides a randomly generated key that augments your password.

How to Transfer Google Authenticator Codes to a New Phone

Mobile devices are rather transient in nature. However, and are usually replaced multiple times within a short time period. This means that you’ll have to move your 2FA verification to the new device to keep enjoying this enhanced security that 2FA allows. In this article, we’ll show you how to transfer Google Authenticator codes to a new phone to allow you to keep using the 2FA functionality.

Transferring Google Authenticator from an Old Phone

First and foremost, do not delete the Google Authenticator on your old phone. You will need it if you wish to transfer the codes the easy way. If you’ve got a new mobile device and wish to transfer the authenticator, follow the steps below:

Using Phone to Phone Transfer on an Android

  1. Install the Google Authenticator on your new device. You can download it for free in the Google Play Store.
  2. On your old phone, open the Authenticator app.
  3. Tap on the three dots in the upper right-hand corner of the screen.
  4. Tap on Transfer Accounts.
  5. Tap on Export Accounts.
  6. Verify your identity.
  7. Choose the account information you wish to transfer from the list.
  8. Tap on Next.
  9. On your new phone, tap on the same three dots icon.
  10. Tap on Transfer Accounts.
  11. Tap on Import Accounts.
  12. Tap on Scan (?)QR code.
  13. Use your new phone to scan the code.
  14. Tap on Done on both devices.

How to Install Google Authenticator Using 2 Step-Verification Code

Using the Google Website on either Android, iPhone, or iPad

  1. Install Google Authenticator for your new device. Download it from the Google Play store or the Apple App Store.
  2. Next, you’ll need to open Google’s Two-Step Verification Enrollment Page. This is best done using a computer, if only for convenience, but can be done using your phone or tablet as well as your web browser on these devices.
  3. Sign in using the Google Account whose codes you want to transfer.
  4. Scroll down the 2 Step Verification Page then click on Change Phone on the Authenticator App Tab.
  5. Select the OS version of your device. Either Android or iPhone.
  6. Click on Next.
  7. On your new phone, open the Authenticator app.
  8. You will now be given two options to activate the Authenticator. Either scan the barcode or enter the security key. If your device is capable of scanning a barcode, choose that option on both your new phone and on the Two-Step Verification Enrollment page.
  9. Either scan the code or enter the key. You will receive a time-sensitive code that you’ll need to enter on the enrollment page.
  10. Once the code is entered, your setup is complete.

This first step has now transferred your Google Authenticator from one phone to the other, but this is only for your Google Account itself. If you’ve used the authenticator as a 2FA verification tool for other sites, you will need to transfer them one by one. This is why it’s important that you don’t remove your old verification app.

Most websites will have their 2FA settings under security, so remove the old two-factor protection then, set up another one using your new device.

Please note that when setting up Two Factor Authentication for the first time, or turning it on after removing it, you will be asked for a backup login option. Choose ‘Use Another Backup Option’ rather than a text message or phone call. This is in case you lose your phone and need to log into your account to disable the old 2FA. Either download or print the codes given and keep them safe

What if I Lost My old Phone or It Was Stolen?

Losing or getting your phone stolen are the reasons why you shouldn’t use text or voice prompts as backup login options. The likelihood of these happening is quite high and may mean getting locked out of your account.

You can choose between several options to back up your account login:

Downloaded or Printed Back up Login Codes

  1. Log into your account using the codes provided. Please be aware that each of the ten codes provided can be used only once per login, so you should change your authenticator device as soon as possible. Also, turning off, then turning back on Google 2FA provides you with a different set of codes each time.
  2. Follow the steps above to transfer the authenticator from one device to another.

You Have a Second Step Verification Prompt

  1. Login to your account using your password and your second step verification.
  2. Open the Two-Step Verification Enrollment Page.
  3. Scroll down and look for the security key in your old phone. Next to that security key, click on Edit.
  4. Click on Remove This Key.
  5. Select Ok.
  6. Install a new Security Key using your new phone by clicking Add Security Key, then follow the instructions provided.

You Don’t Have a Second Step or You Can’t Remember Your Password

  1. Go to Google’s Account Recovery Page.
  2. Enter your account name.
  3. Click on Next.
  4. You will then be asked several questions to verify your identity.

Here are a few important tips to remember when recovering an account:

  1. Try to recover your account from a device or location that you’ve used to log in before.
  2. If you remember your password, make sure that it is correctly entered and the caps lock isn’t on. Try to answer the security passwords as accurately as possible.
  3. When asked for the last password that you remember for that account, try and make the best guess possible.
  4. If you have a backup email connected to the account, enter it now.
  5. Add helpful details for the reasons why you can’t access your account.
  6. Check the Spam folder for Google’s responses. They can sometimes be sent there.

It usually takes three to five business days for your problem to be resolved. Once you’ve logged into your account, replace the 2FA settings as detailed in the steps given above.

Additional FAQs

These are the most commonly asked questions during discussions about Google’s 2FA and Authenticator Codes:

How Do I Reset Google Authenticator?

Turning off your Google Authenticator then turning it back on is essentially a reset as the codes that you are given are unique every time. Try not to do this too often as resetting the authenticator on your Google account doesn’t reset it for other third-party sites that use the authenticator as well.

How Do I Enable 2FA on More Than One Device?

Multiple devices can be used for the same authenticator by scanning the same QR code during the initial 2FA setup. Install the Google Authenticator app on all the devices you wish to use, then proceed with the steps above.

When asked to scan the QR code, use all the devices you want one by one. Once done, any of the setup devices will receive prompts and can be used to verify account logins.

How Do I Backup Google Authenticator?

This can also be done during setup. As suggested in the section on transferring the authenticator, the backup codes can be used to restore your old authenticator.

Another method is to take a screenshot of the QR code as displayed on the screen during setup and keeping it somewhere safe. When setting up a new phone, scan the saved QR code to set up the same authenticator.

How Do I Bind Google Authenticator?

This is different for each website that uses Google Authenticator as a 2FA method. Most will have the settings under their Security Page. Open said page on the website and find the portion that says Google Authenticator.

You should be given a QR code that can now be scanned using the Google Authenticator App. The app will then generate a six-digit code which you can submit to the website’s Google Authenticator input box. Once the website verifies the code, your Authenticator will be bound with the website.

How Do I Restore My Authenticator App?

If you had saved the backup codes or the old QR image, restoring your Google Authenticator is just a matter of reinstalling the app then entering one of the security keys or rescanning the QR code.

How Do I Add an Authenticator?

If you wish to set up a Google Authenticator for your account, follow these steps:

• Open your Google Account.

• On the menu to the left click on Security.

• Scroll down until you find the Signing into Google tab. Click on 2-Step Verification.

• You will now see the 2FA setup menu. Follow the steps given above for adding an authenticator.

Surefire Protection

The Google Authenticator is a surefire way to protect yourself from common hacking attempts to get your private information. Knowing how to transfer the Authenticator from one device to another ensures that you are still protected even when you replace your old devices.

Have you had any experiences transferring your Google Authenticator codes to a new phone? Share your thoughts in the comments section below.

How to recover Google authenticator account - 2 FA key recovery

Get a new phone for the holidays? Congrats! It's exciting to get the latest tech, be it in an iPhone 12, a Galaxy S20 FE or any one of our other top picks in 2020. Don't get too excited, though. There's an important step you need to take before discarding your old phone: Make sure to transfer the accounts you have set up in Google Authenticator to your new phone. 

Doing so will ensure you can still access your two-factor codes and sign in to those accounts on your new phone. Without those codes, you could very well end up locked out of your online accounts. And thanks to a recent update to the iPhone version of Google Authenticator, you can now easily transfer your accounts from one phone to another, which has been possible on Android for the last few months.

Get the CNET How To newsletter

Receive expert tips on using phones, computers, smart home gear and more. Delivered Tuesdays and Thursdays.

Two-factor authentication adds an extra layer of security to your online accounts by requiring a randomly generated six-digit code after you've entered your password. As privacy concerns continue to rise amid breach after breach, two-factor authentication (along with a password manager) is an important step that can help fortify your online security by making it harder for others to take over your accounts. 

Most websites give you the option to receive your 2FA codes through SMS texting or by using a dedicated app such as 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, receiving the two-factor codes sent to your phone number. In 2019, Twitter CEO Jack Dorsey's Twitter account was taken over after his phone's SIM card was changed. 


Here's what you'll need to do to transfer your accounts from one phone to another. It shouldn't take too long, but it's a good idea to set aside some time to make sure it all goes smooth. 

Use the import tool to speed up the process

If you're switching from one Android phone to another, make your life easier by using the app's transfer tool. Make sure you have the latest version of Authenticator on your old phone by checking for updates in the Play Store on Android or the App Store on iPhone. You'll need to have Authenticator installed on your new phone, too: Download here for iPhone or Android.

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


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. 


The old school way still works

If the transfer tool doesn't work for you, you can still set up Authenticator using the old method of manually transferring your accounts, one by one. Here's what you'll need to do to transfer your Google account:

1. Install Authenticator on your new phone. 

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


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. 


Google auth import


This library simplifies using Google’s various server-to-server authentication mechanisms to access Google APIs.


You can install using pip:

$ pip install google-auth

For more information on setting up your Python development environment, please refer to Python Development Environment Setup Guide for Google Cloud Platform.

Supported Python Versions

Python >= 3.6

Unsupported Python Versions

  • Python == 2.7: The last version of this library with support for Python 2.7 was google.auth == 1.34.0.
  • Python 3.5: The last version of this library with support for Python 3.5 was google.auth == 1.23.0.


Contributions to this library are always welcome and highly encouraged.

See CONTRIBUTING.rst for more information on how to get started.


Apache 2.0 - See the LICENSE for more information.

How to Transfer Google Authenticator Accounts to New iPhone or Android - Quick and Easy (2021)

Google Auth Python Library


This library simplifies using Google's various server-to-server authentication mechanisms to access Google APIs.


You can install using pip:

$ pip install google-auth

For more information on setting up your Python development environment, please refer to Python Development Environment Setup Guide for Google Cloud Platform.

Supported Python Versions

Python >= 3.6

Unsupported Python Versions

  • Python == 2.7: The last version of this library with support for Python 2.7 was google.auth == 1.34.0.
  • Python 3.5: The last version of this library with support for Python 3.5 was google.auth == 1.23.0.


Google Auth Python Library has usage and reference documentation at

Current Maintainers



Contributions to this library are always welcome and highly encouraged.

See CONTRIBUTING.rst for more information on how to get started.


Apache 2.0 - See the LICENSE for more information.


You will also be interested:

That is, us. Men are standing. and women to the bottom.

8695 8696 8697 8698 8699