gcobb321 / icloud3_v3

iCloud3 v3, Development Version - This Repo/Version is used for development and testing of new and updated features. It is not the official release of iCloud3 v3, .
MIT License
169 stars 13 forks source link

rc7.1.1 Invalid Authentication, was working on rc7 and pr1.5 #221

Closed Snuffy2 closed 9 months ago

Snuffy2 commented 1 year ago

It turns out I never was actually running rc6 due to the issues you noted in #219

But yesterday I was running rc7 and was not getting Authentication errors. I had downgraded to rc6 (actually pr1.5) after the other errors in #219 and ran that without issues until ~6pm tonight. I then upgraded to rc7.1.1 and restarted HA and got the Authentication errors in the log.

I'll see if I somehow tried to login too much and got blocked by apple somehow and if it starts working later tonight/tomorrow. Tomorrow, I'll also try reverting to rc6 again if I'm still not able to authenticate.

icloud3-0.log

gcobb321 commented 1 year ago

I beat on the reauthentication pretty hard doing some debugging Tuesday without any problems testing invalid p/w entry with wrong p/w and various confirmation screens. Never had an issue.

Try going back into Configure Settings > Enter/Request Verification Code screen and request a code. Enter and go from there.

A lot of times, when I entered the wrong p/w, it asked for a new code. Maybe your ‘verification code neededz’ was a coincidence due to the reinstalls.

Snuffy2 commented 1 year ago

Sorry, I forgot to mention that, brain fart. I did try going into the options and logging in again. I ensured name/pass was correct and still got the error. I tried to resend a new code and that also didn't work.

2023-10-19_20-42-17 260 2023-10-19_20-42-42 361
gcobb321 commented 1 year ago

Unknown error is a bug. There should be error messages in the HA and iCloud-0.log files. Devices & services > system > logs might also have some info. Send me anything you can.

Țry Event Log > Actions > Rest iCloud Interface which will delete cookies and tokens which will generate a new code. HA should then highlight the notification bell and take you to a code entry screen.

Snuffy2 commented 1 year ago

Sorry, I don't see the option to Reset the iCloud Interface in the Event Log Actions. Unknown error details below.

2023-10-19_21-16-23 2023-10-19_21-16-54

Unknown error details:

2023-10-19 19:43:17.569 ERROR (MainThread) [icloud3-cf] Error logging into iCloud service: Login Error (Invalid username/password)/609
2023-10-19 19:43:34.189 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 234, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 394, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/icloud3/config_flow.py", line 2098, in async_step_reauth
    if self.username == Gb.PyiCloud.username and self.password == Gb.PyiCloud.password:
                        ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'username'
gcobb321 commented 1 year ago

I think what was happening is several errors happen at once that were not being caught along with a sequence of steps I didn’t anticipate.

The Gb.PyIcloud is the iCloud session logged into when iCloud3 starts. This was not done because of a missing username or p/w. When it was entered on the config screen a different iCloud session is set up in case the username or p/w was for another account. That generates a verification code request that was checking the startup session for its info, which was not done. I found that if you tried the username or p/w without logging in first, the Gb. variables were not set up and generated the error. I don’t know if that was the sequence you did but that has been fixed.

Doing a login first will login and then take you to the code entry screen but the attached module should prevent that error.

Unzip it into the icloud3 directory and restart HA.

config_flow.zip

Snuffy2 commented 1 year ago

So far it appears to be working with the updated config_flow. No errors and the location appears to be properly updating. Thanks!

gcobb321 commented 9 months ago

Closing this issue with the release of v3.0