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

Unknown Error when submitting Captcha Info or Verification Method #568

Closed
devinjparsons opened this issue Feb 20, 2020 · 31 comments · Fixed by #672
Closed

Unknown Error when submitting Captcha Info or Verification Method #568

devinjparsons opened this issue Feb 20, 2020 · 31 comments · Fixed by #672

Comments

@devinjparsons
Copy link

devinjparsons commented Feb 20, 2020

When adding integration at the submitting Captcha form, it returns an Unknown Error message after about 15-30 seconds of spinning. Looking through the logs I can't find a specific error. I can ping alexa.amazon.com from my HA system. I don't have a pickle file and looking through the advanced html files that get generated everything seems ok, just seems to fail at captcha submission.

System details

  • Home-assistant (version): 0.105.5
  • Hassio (Yes/No): Yes
  • alexa_media (version from const.py or HA startup): 2.5.5
  • alexapy (version from pip show alexapy or HA startup):

Logs

2020-02-20 09:49:08 DEBUG (MainThread) [custom_components.alexa_media.config_flow] show_form user None None OrderedDict([('email', <class 'str'>), ('password', <class 'str'>), ('url', <class 'str'>), ('debug', <class 'bool'>), ('include_devices', <class 'str'>), ('exclude_devices', <class 'str'>), ('scan_interval', <class 'int'>)])
2020-02-20 09:49:25 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating new login
2020-02-20 09:49:26 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Testing login status: {'error_message': 'Important Message!\n            To better protect your account, please re-enter your password and then enter the characters as they are shown in the image below.\n          ', 'captcha_required': True, 'captcha_image_url': 'https://opfcaptcha-prod.s3.amazonaws.com/7858e8c0cbb940babfb9e890e6e71dfc.jpg?AWSAccessKeyId=AKIA5WBBRBBBUVOQGKFM&Expires=1582217666&Signature=CMplDWJDDI9cTQz7LRy7yqj8d2g%3D'}
2020-02-20 09:49:26 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating config_flow to request captcha
2020-02-20 09:49:26 DEBUG (MainThread) [custom_components.alexa_media.config_flow] show_form captcha {'email': '########@gmail.com', 'url': 'amazon.com', 'captcha_image': '[![captcha](https://opfcaptcha-prod.s3.amazonaws.com/7858e8c0cbb940babfb9e890e6e71dfc.jpg?AWSAccessKeyId=AKIA5WBBRBBBUVOQGKFM&Expires=1582217666&Signature=CMplDWJDDI9cTQz7LRy7yqj8d2g%3D)](https://opfcaptcha-prod.s3.amazonaws.com/7858e8c0cbb940babfb9e890e6e71dfc.jpg?AWSAccessKeyId=AKIA5WBBRBBBUVOQGKFM&Expires=1582217666&Signature=CMplDWJDDI9cTQz7LRy7yqj8d2g%3D)', 'message': '\n> Important Message!\n            To better protect your account, please re-enter your password and then enter the characters as they are shown in the image below.\n          '} {} OrderedDict([('password', <class 'str'>), ('captcha', <class 'str'>)])
2020-02-20 09:50:33 WARNING (MainThread) [custom_components.alexa_media.config_flow] Unknown error: 
2020-02-20 09:50:33 DEBUG (MainThread) [custom_components.alexa_media.config_flow] show_form user None {'base': 'unknown_error'} None`
@alandtse
Copy link
Owner

Thanks. We'll probably need the debug logs from alexapy.

It also may be helpful to get the html pages that are causing the error.

@devinjparsons

This comment has been minimized.

@alandtse

This comment has been minimized.

@devinjparsons

This comment has been minimized.

@devinjparsons

This comment has been minimized.

@Francisk0

This comment has been minimized.

@RoldyBuffalo

This comment has been minimized.

@alandtse

This comment has been minimized.

@RoldyBuffalo

This comment has been minimized.

@alandtse
Copy link
Owner

alandtse commented Mar 13, 2020

Enabling a 2FA in an app is a workaround because it avoids the page that is currently broken which is the page that gives options for how to generate a code. ;) I use an app so I don't ever see the page so that's why I'm trying to get someone to get me the html to review.

As for why the component may suddenly work on reboot after enabling 2FA, sometimes Amazon will ask for the 2FA verification even if you don't have it set up. If you suddenly set it up, that security check may disappear and thus the component works again.

@alandtse
Copy link
Owner

alandtse commented Mar 15, 2020

@devinjparsons I think I found the potential cause on the 2FA page error you ran into based off your logs. However, if it's still intermittent on other pages, I don't know if it'll help. You can try the alexapy PR I have posted to see if it helps.

@Francisk0 I'll need alexapy logs to see what caused your error.

For anyone else coming here I will need your alexapy logs and advanced debugging logs to generate the webpages Amazon is showing to help you. Specifically, some of you have reported that you have the option to push to your device. I don't know how you set that up so explaining how to do that would help me.

@drthanwho
Copy link

Another potential workaround for now is like this:

Add your details: email, password, server, etc.
It will ask for captcha and to reenter your password.
On the password field following your password add the 2FA code from the app.

Even though I have the app if I continue as normal and then try adding the 2FA code, after captcha verification, it won't work

@grantalewis
Copy link

grantalewis commented Mar 18, 2020

Thanks to the posts in this thread, here are the steps that I finally got to work:

  • Install an Authenticator App (I use Google Authenticator) on your phone.
  • Set up your Amazon account with 2FA.
  • Access Home Assistant using the mobile app on your phone.
  • Click Notifications and enter the CAPTCHA.
  • You'll then be prompted to enter a 2FA code from your Authenticator App. Do so.

@alandtse I have debug logs, screen shots, and HTML files I generated during the troubleshooting process. I don't feel like going through the hassle of scrubbing them for personal data, but I trust that you're an honest person and so am willing to send them to you privately. Feel free to email me: g_r_a_n_t_a_l_e_w_i_s_@g_m_a_i_l._c_o_m (remove all underscores).

@alandtse
Copy link
Owner

Workaround are above if you just want to log in. Additional info below if you want to help debug.

If you are looking at your logs as you are trying to log in, I left in a secret debug mode where you can navigate the links in any page.
You'll need to see the logs for the page where it identifies the links:

2020-03-18 16:39:50 DEBUG (MainThread) [alexapy.alexalogin] Links: {'0': ("Didn't receive the OTP?", 'https://www.amazon.com/ap/mfa/new-otp?ieXXX')}

You can then choose to choose a link by typing in link0 where 0 is the number listed. Please note, the component can only process certain pages, so the purpose of this is to try to get the get.html and post.html for any page. However, it will let you select different methods for the OTP though. You may end up at a page where the component can't handle it and you'll have to start the login process all over again.

I am still trying to get the get.html and post.html for this page. Would really appreciate logs and the html pages.
image

@grantalewis

This comment has been minimized.

@TimothyGaray
Copy link

FWIW... I don't know how my phone and my tablet got setup as potential push destinations for a code. They don't show in my advanced security settings on Amazon. It could be because I installed Alexa apps on both. It could be because I have Amazon apps on both.

@TimothyGaray

This comment has been minimized.

@TimothyGaray
Copy link

I tried uninstalling the Alexa app from my tablet but it still shows up as a push target for the code.

@devinjparsons

This comment has been minimized.

@alandtse
Copy link
Owner

FYI I'm fairly certain I had the debug logger running the entire time, including the time when the above sms/email message displayed.

@grantalewis Thanks, I didn't see it. You'll notice in @TimothyGaray 's logs that there's clearly a section talking about the push notification.

@TimothyGaray Thanks for posting. As a note, the code should allow you to select the push notification options with typing whatever is in bold, e.g., Timothy's Samsung Galaxy Tab S3. Of course, there could be something wrong with the submission page which is why I was trying to get the HTML.

@devinjparsons You don't have to. The 2.5.7 has it built in.

@devinjparsons

This comment has been minimized.

@alandtse

This comment has been minimized.

@Silvenga
Copy link

I did discover that removing the "push device" (the Amazon shopping app) from my amazon account allowed me to pass the sms/email message during login. In fact, I was no-longer prompted to do a second-factor challenge after that device was removed.

@alandtse alandtse changed the title Unknown Error when submitting Captcha Info Unknown Error when submitting Captcha Info or Verification Method Apr 4, 2020
This was referenced Apr 11, 2020
@mamos76
Copy link

mamos76 commented Apr 20, 2020

even after updating to 2.5.14 the problem remains. the integration cannot send the code message to the phone. I tried all the other methods but it didn't work

@javiermartingonzalez
Copy link

From today, my account was disconnected and having same problem.

I'm getting device option and SMS. If a press device, I receive a notification from Amazon saying that it's me. I pressed 'yes' and get a "Signin confirmed" but components is asking for a confirmation code. For SMS option, not receiving the message.

@ionut-tanasa
Copy link

From today, my account was disconnected and having same problem.

I'm getting device option and SMS. If a press device, I receive a notification from Amazon saying that it's me. I pressed 'yes' and get a "Signin confirmed" but components is asking for a confirmation code. For SMS option, not receiving the message.

same for me.

@alandtse
Copy link
Owner

Either use a workaround or provide logs so I can try to fix it. If I don't get the info, there will be no fix coming since I can't reproduce it.

@sagitt

This comment has been minimized.

@ionut-tanasa
Copy link

@alandtse I enabled two factor auth in my amazon account and it worked. Didn't have it enabled yet.

@sagitt you can try enabling two factor auth and try again. It worked for me

@sagitt
Copy link

sagitt commented Apr 25, 2020

@alandtse I enabled two factor auth in my amazon account and it worked. Didn't have it enabled yet.

@sagitt you can try enabling two factor auth and try again. It worked for me

using two step with authy worked for me too
thanks

@alandtse
Copy link
Owner

Working on a potential fix based off latest info about an anti-automation page. You'll need to be comfortable replacing your alexapy files. Please only do this if you understand what you're doing as I won't be providing support if you try this. If you do test it, please turn on advanced debugging and be prepared to send me your logs/html pages (scrubbed of course).

  1. Replace alexalogin.py with this version.
  2. Reboot.
  3. Report on results.

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

Successfully merging a pull request may close this issue.