fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
955 stars 80 forks source link

Add captcha support to Add-on Login State #140

Closed Chrisco93Main closed 2 years ago

Chrisco93Main commented 3 years ago

Hello I am getting the following error.

2021-11-29 15:41:25.035 ERROR Response code not ok { code: 100032, msg: 'Failed to request.' } 2021-11-29 15:41:25.035 ERROR Token error { method: 'post', endpoint: 'v1/app/get_devs_list' } 2021-11-29 15:41:25.122 ERROR Status return code 401, invalidate token { status: 401, statusText: 'Unauthorized' }

I am going to guess it is because when I try to sign into my Eufy account on the app, I am getting a prompt for a captcha to prove I am not a robot.

Chrisco93Main commented 3 years ago

Looks like changing the configuration to use the IP instead of localhosr fixes the problem now.

tromarek1 commented 3 years ago

I don't know why my problem is merged to this issue, because I have different problem. I haven't arrived by the time I entered the IP address. I'm at the stage of logging into my eufy account

Even when I go through all the steps, the problem remains the same regardless of the entered ip address

fuatakgun commented 3 years ago

I don't know why my problem is merged to this issue, because I have different problem. I haven't arrived by the time I entered the IP address. I'm at the stage of logging into my eufy account

Even when I go through all the steps, the problem remains the same regardless of the entered ip address

Your problem is that you are not able to login because eufy servers are asking captcha code to enter through add on.

Until you have this functionality, you will not be able to login.

Not all accounts are required to enter a code while logging in and some logged in accounts can reuse their existing cookies to skip over this.

fuatakgun commented 2 years ago

I am not able to test this anymore because my two accounts are not asked for captcha anymore !!!

Chrisco93Main commented 2 years ago

I am not able to test this anymore because my two accounts are not asked for captcha anymore !!!

Something that might kickoff the request for Captcha is if you turn on two step verification and get the 401 errors when using this integration. Eufy should be spamming your email with codes. Then turn off two step.

I am wondering if they are using Captcha as a mechanism to prevent email spam.

fuatakgun commented 2 years ago

thanks for the tip, it started popping again without enabling 2FA, I am able to capture captcha image from add-on and show it in Reauthentication window of integration.

Next step is to get user input and hand over to add-on. Hopefully, I can close on this in couple of days.

fuatakgun commented 2 years ago

Update: I am able to move forward with captcha support, hopefully release a new version tomorrow. Keep tight

dMopp commented 2 years ago

AddOn is not working here, because of:

2021-12-10 09:05:13.605 ERROR Status return code 401, invalidate token { status: 401, statusText: 'Unauthorized' } 2021-12-10 09:05:13.608 ERROR Status return code not 200 { status: 401, statusText: 'Unauthorized' } 2021-12-10 09:05:13.666 ERROR Status return code 401, invalidate token { status: 401, statusText: 'Unauthorized' } 2021-12-10 09:05:13.668 ERROR Status return code not 200 { status: 401, statusText: 'Unauthorized' } 2021-12-10 09:05:13.727 ERROR Status return code 401, invalidate token { status: 401, statusText: 'Unauthorized' } 2021-12-10 09:05:13.728 ERROR Status return code not 200 { status: 401, statusText: 'Unauthorized' }

i guess thats because of the token i always ahve to enter .. :( 2FA already deactivated

fuatakgun commented 2 years ago

if you have already deactivated 2fa, it should be about captcha information. more info here: https://github.com/fuatakgun/eufy_security/issues/140

dMopp commented 2 years ago

Changing to which ip? The one of the HA VM, the one of the Docker container (not fixed) ? I cant se any fix here for now :(

I guess i ahve to wait until you are releasing the captcha support version

fuatakgun commented 2 years ago

I have tried this ip changing in my dev desktop, it is not working all the time. I would take this as an one time fix, I am working on improving integration to enter captcha when integration fails because of captcha request.

fuatakgun commented 2 years ago

main issue is that;

dMopp commented 2 years ago

Eufy/Anker should provide Application Passwords for calls like that :(. And i totally understand, its hard to work arround that issue, dont get me wrong here :)

fuatakgun commented 2 years ago

I am not sure if they are aware of our attempts to fetch this data from cloud and local devices :)

fuatakgun commented 2 years ago

I have released a new commit, please get these changes and try locally. If you are asked for captcha, integration will throw an error. will ask you go to Integrations page to enter captcha. Click on CONFIGURE and enter captcha correctly (please). If you fail to do, you need to disable and enable the integration back again. If you input correct code, your integration will be ready in couple of minutes.

This solution is far from perfect and clear, this is best I can do now. I will also update README with screenshots.

jermstheitguy commented 2 years ago

Worked like a Charm!

dMopp commented 2 years ago

Works Great. Thank you ! (Should work for 2FA, too* but iam happy now)

*just the Input field

fuatakgun commented 2 years ago

Happy to this eventually

fuatakgun commented 2 years ago

Works Great. Thank you ! (Should work for 2FA, too* but iam happy now)

*just the Input field

Tell me the pain to implement 2fa :-)