Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import from authy fails #1077

Closed
ThePinkUnicorn6 opened this issue Jan 1, 2023 · 15 comments · Fixed by #1278
Closed

Import from authy fails #1077

ThePinkUnicorn6 opened this issue Jan 1, 2023 · 15 comments · Fixed by #1278
Labels
bug A bug report

Comments

@ThePinkUnicorn6
Copy link

Version

2.1.2

Source

F-Droid

Vault encryption

Yes (with biometric unlock)

Device

Oneplus 3t

Android version

Android 11

ROM

Havoc OS 4.19

Steps to reproduce

On a rooted phone with authy installed and 2fa codes in it, open aegis, go to settings and then import from app. When authy is selected and ok is pressed, it will give an error message and in more details it will show:
com.beemdevelopment.aegis.importers.DatabaseImporterException: java.io.FileNotFoundException: No such file or directory: /data/user/0/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml

What do you expect to happen?

It to import the 2fa codes from authy

What happens instead?

It fails to find the file the tokens are stored in

Log

No response

@ThePinkUnicorn6 ThePinkUnicorn6 added the bug A bug report label Jan 1, 2023
@ayuinaba
Copy link

ayuinaba commented Jan 7, 2023

I'm using Lineage 19.1 (freshly installed, rooted with Magisk), and I encountered the exact same problem.
Microsoft Authenticator imported seamlessly, for reference.

@alexbakker
Copy link
Member

I haven't taken a look at this yet, but if you guys indeed have Authy installed, are logged into the app and that file doesn't exist.. It may mean that Authy now stores everything in a different file and perhaps in a different format as well. This'll require a bit of investigation.

@ayuinaba
Copy link

Can confirm I did have Authy installed, logged into it, and couldn't import into Aegis, with the same error as the OP.
As a temporary solution, I used this guide to export my 2FA codes, and successfully imported them into Aegis.

@Trup3s
Copy link

Trup3s commented Feb 11, 2023

Can confirm that the import does not work. I managed to manually navigate to /data/data/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml using a file explorer that allows root access to the storage. Looks like the file is still in the same path, but the one aegis uses is incorrect. Surprisingly when I try to import an Authy file manually via the Import from file option, the correct path is displayed.

Edit:

A quick look into the code shows that the man.getApplicationInfo(pkgName, 0).dataDir call returns a wrong path. Maybe this is a OnePlus specific issue since the returned path should normaly be the correct one.

@alexbakker
Copy link
Member

@Trup3s

A quick look into the code shows that the man.getApplicationInfo(pkgName, 0).dataDir call returns a wrong path.

What does it return?

@Trup3s
Copy link

Trup3s commented Feb 11, 2023

@alexbakker

I did not test or debug this, so maybe my assumption was wrong, but the error message states that it could not find a file under data/user/0/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml. A quick check showed that there is no authy directory under data/user/0/, but I could find one under /data/data/. Therefore I concluded that man.getApplicationInfo(pkgName, 0).dataDir returned the wrong path.

@altwu
Copy link

altwu commented Mar 2, 2023

i had the same problem as the OP but my experience was a little different than @Trup3s. /data/user/0/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml and /data/data/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml both exist on my phone and they're identical. when i tried to import from authy, aegis said that i needed the xml from /data/user/0 but when i tried to import from a file, aegis pointed me to the xml from /data/data. when i tried to import from a file, i used root explorer to get to the xml in /data/data but when i selected it, i got a message saying that the file was not readable by non-root apps. but i had granted aegis root access. the permissions on both xml files are 660.

i ended up copying one of the xml files to my internal sdcard and pointing aegis to that and it worked.

my phone is a oneplus 7 pro running oxygen os 11.0.9.1.GM21AA. android version 11. it's rooted with magisk 25.2 with zygisk and ramdisk enabled. i'm running aegis 2.1.3 downloaded from google play with biometric unlock for my vault. the version of authy i have is 24.11.0.

@alexgmin
Copy link

Just adding that I have the same issue on my Google Pixel 7 on Android 13. However, my previous phone and the one I imported the Android backup was a OnePlus Nord CE 5G with Oxygen OS 12, in case that matters.

Can confirm the file exists
Screenshot_20230321-095055~2

And the error is also the same

com.beemdevelopment.aegis.importers.DatabaseImporterException: java.io.FileNotFoundException: No such file or directory: /data/user/0/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml

@Timmmmaaahh
Copy link

Same problem here. This quite simple workaround solved it for me:

  1. Use a root explorer (I used MiXPlorer) to navigate to /data/user/0/com.authy.authy/shared_prefs
  2. Copy 'com.authy.storage.tokens.authenticator.xml' to a non-root location (eg. Download folder)
  3. In Aegis, go to Settings > Import & Export > Import from file > Authy > OK
  4. Select the copied 'com.authy.storage.tokens.authenticator.xml' and choose which 2FA accounts to import
  5. Profit 😎

@Igetin
Copy link

Igetin commented Jun 27, 2023

I also had this problem. It is weird that Authy “does no find” the file when root access is granted and the same file can be verified to exist e.g. via Termux. I wonder if there’s some SELinux shenanigans going on. I’m using Magisk 26.1 and Android 13.

I was able to work around the problem by importing via a file, as suggested in the post above.

@dedroot
Copy link

dedroot commented Jul 3, 2023

Same, here. Galaxy S21 Ultra rooted with Magisk and cannot import from Authy.

The error i got when i try to import Authy tokens to Aegis:

com.beemdevelopment.aegis.importers.DatabaseImporterException: java.io.FileNotFoundException: No such file or directory: /data/user/0/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml

@dedroot
Copy link

dedroot commented Jul 3, 2023

Same problem here. This quite simple workaround solved it for me:

1. Use a root explorer (I used [MiXPlorer](https://forum.xda-developers.com/t/app-2-2-mixplorer-v6-x-released-fully-featured-file-manager.1523691/)) to navigate to /data/user/0/com.authy.authy/shared_prefs

2. Copy 'com.authy.storage.tokens.authenticator.xml' to a non-root location (eg. Download folder)

3. In Aegis, go to Settings > Import & Export > Import from file > Authy > OK

4. Select the copied 'com.authy.storage.tokens.authenticator.xml' and choose which 2FA accounts to import

5. Profit 😎

Oh, it works fine! Thanks for the tip ^^

@yuvve
Copy link

yuvve commented Feb 13, 2024

I managed to solve this problem by changing Magisk mount settings to Global Namespace, as explained here.

I stumbled upon this while trying to copy the com.authy.storage.tokens.authenticator.xml and not understanding why my file explorer couldn't see anything in /data/user/0/.

@alexbakker
Copy link
Member

alexbakker commented Feb 18, 2024

We do actually request the root shell to be run in the global mount namespace:

// To access other app's internal storage directory, run libsu commands inside the global mount namespace
return Shell.Builder.create().setFlags(Shell.FLAG_MOUNT_MASTER).build();

So I'm not sure what we could be doing wrong here.

@alexbakker
Copy link
Member

alexbakker commented Feb 18, 2024

Oh, I see: #1278.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants