alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.52k stars 289 forks source link

How do I get the 2FA code in HA? #2292

Closed zozito closed 4 months ago

zozito commented 5 months ago

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

Hi Guys, how are you doing? I've configured the Alexa Media Player over HACS and I did it the first time 2FA Amazon setup. Right now I can't log in to my Amazon account because it asks me for the 2FA code I don't have. How can I see the code in HA to log in to Amazon?

danielbrunt57 commented 4 months ago

It's not from HA. The 2SV code is in your Amazon account, Your Account > Login & Security > Two-Step verification (2SV) Settings > Two-Step Verification Then click "can't scan the barcode?" to reveal the 52 character OTP (One Time Password for apps) that needs to be entered into the Alexa Media Player installation process.

But if you mean you have configured Amazon 2FA, the only way to do that is by scanning Amazon's 2FA image into an authenticator app like Microsoft, Google, Bitwarden, Authy, LastPass, etc. and then entering the generated code into the Amazon 2FA setup process to confirm it got registered. Afterwards, to log back into Amazon, you have to open the app that you set it up in and enter the new generated code (which changes every 30 seconds) to complete the login.

None of this has anything to do with Alexa Media Player or Home Assistant. You'll have to get Amazon's assistance with your account if you can't find the 2FA app that you set it up in!

zozito commented 4 months ago

Hi @danielbrunt57 thank you for your detailed explanation.

I mistakenly configured the Amazon 2FA directly in Alexa Media Player for the first time. Now, when I try to log into my Amazon account, it asks for a 2FA code that I don't have, preventing me from accessing Amazon products.

According to Amazon's FAQ, I need to send proof of identity so they can reset my 2FA settings. To avoid this, I want to know if it is possible to retrieve the 2FA code from Alexa Media Player so that I can log in to Amazon products normally.

danielbrunt57 commented 4 months ago

I'm not sure having it will solve your problem but it's the "otp_secret" in this entry in/config/.storage/core.config_entries:

      {
        "data": {
          "otp_secret": "<2FA App Key>",
          "email": "your_email@domain",
          "password": " <password> ",
          "url": "amazon.com",
          "debug": false,
          "scan_interval": 1800,
          "include_devices": "",
          "exclude_devices": "",
          "oauth": {
            "access_token": <Access Token>
            "refresh_token": <Refresh Token>
            "expires_in": 1720217060.239656,
            "mac_dms": {
              "device_private_key": <Device Private Key>
              "adp_token": <ADP Token>
            },
            "code_verifier": <Code Verifier>,
            "authorization_code": <Authorization Code>
          }
        },
danielbrunt57 commented 4 months ago

@zozito Have you solved your problem? If so, please close this issue. Thanks!

danielbrunt57 commented 4 months ago

@alandtse Please close this issue...