I would like to script accessing the built-in two factor authentication code that is accessed via System Preferences -> Passwords. One of the apps I use does not prompt for the 2FA code so each time I use it I have to do several clicks to retrieve the code. I am aware there is a mechanism to access Keychain items, but not the 2FA passwords. Does anyone know if there is a way to access these codes via terminal?
Note: I’m not referring to Apple’s own 2FA service to verify Apple ID accounts.