2 factor authentication not set up on phone

I switched to a new phone and did not carry google authentication files over. I tried logging into home assistant and it is asking for the six digit code. Is there any way to fix this without re setting home assistant up?

If you have the Samba Share Add-On installed you should be able to get to the config folder from a computer on the same network and edit the configuration.yaml file to enable the trusted networks option. Reboot and then you should be able to log in without needing a password or 2-factor.

homeassistant:
  auth_providers:
    - type: trusted_networks
      trusted_networks:
        - 192.168.0.0/24

If you have SSH access set up you can get the TOTP code for your user. Open the file /config/.storage/auth_module.totp. This file looks like this:

{
    "version": 1,
    "minor_version": 1,
    "key": "auth_module.totp",
    "data": {
        "users": {
            "<user id>": "<TOTP Code>"
        }
    }
}

If you only have one user with 2FA then copy the one TOTP code and paste it into google authenticator. You’ll need to use the manual entry option, not the scan a barcode option.

If you have multiple users with 2FA then open /config/.storage/auth to find your user ID. You’ll see a list of users in this file, look for your users name and then find its ID. Then find the matching TOTP code for that user in the other file.

If you do not have one of the SSH addons installed then you can do this by connecting a keyboard and monitor to your device. This will give you access to the host shell. Enter login at the prompt once you see it on the screen. From the host shell the files are in a different place though, there is no /config folder. The TOTP file can be found at /mnt/data/supervisor/homeassistant/.storage/auth_module.totp and the auth file with the users at /mnt/data/supervisor/homeassistant/.storage/auth

I do not have ssh enabled. Do I have to use a keyboard and mouse or could I just take the card out and read it that way?

Taking out the card should be fine

Thank you.