A Guide to Obtain TOTP secret key from the Duo Mobile App.

Prerequisites

To access the required application files, you need an android device with root access.

It can either be:

  • A rooted Android device.
  • An Android Virtual Machine with root access (probably more commom).

You also need to have the Duo Mobile app installed and your account fully activated on that device.

Step 1: Locate the Account File

Using a file manager that with root access, navigate to /data/data/com.duosecurity.duomobile/files/duokit/account.json.

This account.json file contains the configuration data for your Duo accounts.

Step 2: Extract the Secret Key

Looking at the file, you might see something like this:

[
  {
    "version": 1.0,
    "accountType": "DuoAccount",
    ...
    "otpGenerate": {
      "otpSecret": "AB4CDEFGH3IJKLMNTEGU5245GT123456\u003d\u003d\u003d"
    },
    ...
  },
  ...
]

Identify the specific account object you want to export from the list.

Within that account’s block, look for the key “otpGenerate”.

The value for “otpGenerate” is another object nested inside. Within this nested object, you will find the key named “otpSecret”.

Replace the \u003d with =. In this example, your key is AB4CDEFGH3IJKLMNTEGU5245GT123456===.

Step 3: Import the Key into a New Authenticator

Open your preferred authenticator app (such as Google Authenticator, Authy, etc.). Choose the option to add a new account by manually entering a setup key. Paste the corrected secret key. Once saved, the new app should generate the same 6-digit codes as Duo.