Featured image of post Backup Google Authenticator

Backup Google Authenticator

How to create a backup or transfer your Google Authenticator to another Android phone using TWRP

Recently I wrote about how my phone crashed itself, got almost completely useless and I ended up having to reinstall it. So far not big deal, but I wanted to keep my Google Authenticator Logins.

Backing up your Google Authenticatoris pretty easy, if you have a phone with TWRP. TWRP is a custom recovery for android phones that allows advanced options like installing a custom ROM or adb (Android debug bridge) access. We will use adb to safely copy our data from a Android phone to a computer.

Copy the app contents

DISCLAIMER: Copying the data is safe for your original phone, but it’s not guaranteed that it will work on your second phone.
Try out if the authenticator on the second device swallows what you serve, before you delete/dispose/reinstall your first device.

Sawing on the branch you are sitting on, might not be a good idea

I am always using TWRP for those actions, because the apps are not running. This means you get the data in offline mode, i.e. when all the apps are closed and not accessing the data at the same time you are backing them up. This avoids unnecessary race conditions and data inconsistency states and can safe you a lot of headache. Anyways - it should also work from an active Android, but don’t be surprised if bad things happen.

In TWRP back up the following folder from your android phone.

adb pull -p /data/data/

This is your offline backup. Don’t forget to encrypt it, if you store it somewhere.

If you want to transfer this to another Android device, then first install the Google authenticator, and then copy the data over

adb push -p /data/data/

Just show/extract the secret

If you just want to get the secrets, it’s sufficient to just extract the file

And then list the contents with the sqlite3 utility

adb pull /data/data/
sqlite3 ./databases
select * from accounts;

Then they are listed on your screen. Store them to a text file, print them out or do whatever you want to do with them. Remember also here to encrypt them, if you want to store them away safely.