Repository: alandtse/alexa_media_player

Issue #1617: Invalid Built-In 2FA key
Created: 2022-05-29T19:04:20Z
Hi,
after updating to the latest version I cannot authenticate !
Allways get "Invalid Built-In 2FA key" when putting in the correct code from the APP.

Duplicate issue #1628: Invalid Built-In 2FA key
Created: 2022-06-05T19:24:18Z
Describe the bug
After HACS update to 4.0.2 and a HA reboot, the AMP integration can no longer log in. Trying to enter my login details with 2FA results in immediate error (like it didn't even try to sent it).
To Reproduce
Steps to reproduce the behavior:

Go to HA integrations and click on Reconfigure for the Alexa Media Player integration.
Double check all info that is pre-populated
Enter current 2FA code
click Submit and get 'Invalid Built-In 2FA key' error in pop-up box.

Expected behavior
Expected the integration to login to my Amazon account and be authorized.
Screenshots

System details

Home-assistant (version): 2022.6.2
Hassio (Yes/No): Yes.
alexa_media  (version from const.py or HA startup): 4.0.2
alexapy (version from pip show alexapy or HA startup): 1.26.0
Amazon 2FA is enabled (y/n). We will not debug login issues if unanswered: yes

Logs
2022-06-05 15:23:14 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Using existing login
2022-06-05 15:23:14 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for ******
2022-06-05 15:23:14 WARNING (MainThread) [alexapy.alexalogin] Error creating TOTP; ****** likely invalid
2022-06-05 15:23:37 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Using existing login
2022-06-05 15:23:37 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for ******
2022-06-05 15:23:37 WARNING (MainThread) [alexapy.alexalogin] Error creating TOTP; ****** likely invalid

From HA restart:
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.alexawebsocket] mac_dms not detected; websocket likely won't connect
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_devices((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_bluetooth((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_dnd_state((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_guard_details((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 WARNING (MainThread) [alexapy.helpers] alexaapi.get_network_details((<alexapy.alexalogin.AlexaLogin object at 0xffff65d09a90>,), {}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
('Session is closed',)
2022-06-05 15:28:09 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Session is closed

Additional context
[]

Closing comment (2022-06-05T20:33:06Z): Dupe of #1617