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

Not able to Log In. Unknown Error Occurred #2393

Closed
Techposts opened this issue Aug 3, 2024 · 75 comments
Closed

Not able to Log In. Unknown Error Occurred #2393

Techposts opened this issue Aug 3, 2024 · 75 comments
Assignees
Labels
bug Something isn't working duplicate This issue already exists pr-submitted

Comments

@Techposts
Copy link

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

Enabled the 2FA. Added the Google Authenticator App. The integration is showing the OTP which matches the OTP on the Google Authenticator but when I click SUBMIT, it says Unknow Error occurred.

Tried Amaozn.com and Amazon.in

chrome_nD1PMEjFbN
chrome_4ncBT5GfUR
chrome_UEic2XZkDj
chrome_sjbFghY6Py

Logs
No logs generated for this as integration is failing. Alexa Media Player v4.12.4

(https://github.com/alandtse/alexa_media_player/wiki/FAQ#how-do-i-enable-debug-logging-for-the-component).

@jeng37
Copy link

jeng37 commented Aug 3, 2024

Exactly the same problem for me but for amazon.de

@MichaelGier
Copy link

for me the same problem. amazon.de

@pkmaxl
Copy link

pkmaxl commented Aug 3, 2024

I have the same problem. amazon.de

@DrazorV
Copy link

DrazorV commented Aug 3, 2024

same

@aptonline
Copy link

Same issues with amazon.co.uk, logs show:

2024-08-03 09:28:30.310 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry email@email.com - amazon.co.uk for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 360, in async_setup_entry
if await test_login_status(hass, config_entry, login):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 1396, in test_login_status
async_create_persistent_notification(
TypeError: async_create() missing 1 required positional argument: 'hass'

@robercy
Copy link

robercy commented Aug 3, 2024

Me too, on amazon.com!

@jleinenbach
Copy link
Contributor

Same issues with amazon.co.uk, logs show:

2024-08-03 09:28:30.310 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry email@email.com - amazon.co.uk for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 360, in async_setup_entry
if await test_login_status(hass, config_entry, login):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 1396, in test_login_status
async_create_persistent_notification(
TypeError: async_create() missing 1 required positional argument: 'hass'

I have the same issue with amazon.de. I fixed this error message with ChatGPT support by adding "hass,", but that didn't fix this login problem:

async_create_persistent_notification(
    hass,
    message=message,
    title="Alexa Media Reauthentication Required",
    notification_id=f"alexa_media_{slugify(login.email)}{slugify(login.url[7:])}",
)

@basti4874
Copy link

basti4874 commented Aug 3, 2024

I have the same problem, tried all browsers, no success.

@sharpe7852
Copy link

I have the same issue on v4.12.4

@Teme-V
Copy link

Teme-V commented Aug 3, 2024

Same here, v4.12.4
Amazon.de
#2393 (comment)

@c3p0vsr2d2
Copy link

Amazon.com. Same problem.

@aguiducci
Copy link

Same error with amazon.it and using nabu casa URL for external access and Alexa integration

@yashijoe
Copy link

yashijoe commented Aug 3, 2024

Same here. Amazon.it
Back to 4.12.1, still working.

@Clamb94
Copy link

Clamb94 commented Aug 3, 2024

Same issue on amazon.de

@danielbrunt57 danielbrunt57 self-assigned this Aug 3, 2024
@danielbrunt57 danielbrunt57 added bug Something isn't working duplicate This issue already exists todo 🗒️ labels Aug 3, 2024
@compoundbow83
Copy link

Sames issue on amazon.de

@ryebreadsalad
Copy link

same issue on amazon.de when setting up the integration (no 2FA fields filled in)

@Maorbz
Copy link

Maorbz commented Aug 3, 2024

Same here

@M3XXstmk
Copy link

M3XXstmk commented Aug 4, 2024

Hello - Amazon.de. Same problem.

@Mally2004uk
Copy link

Same problem also. i have the problem when trying to add media player to home assistant

@Obmawo
Copy link

Obmawo commented Aug 4, 2024

Same here. Amazon.de

@aptonline
Copy link

According to the PR from @danielbrunt57 this appears to have been fixed and just waiting for it to be merged so no more ‘me too’ needed 😀

@jleinenbach
Copy link
Contributor

jleinenbach commented Aug 4, 2024

According to the PR from @danielbrunt57 this appears to have been fixed and just waiting for it to be merged so no more ‘me too’ needed 😀

After manually applying the fix according to the pull request, the 'Unknown Error Occurred' message was resolved. However, there is now a problem with the login process. Here is a detailed description of the steps and the issue:

  1. Entering OTP-key into the Integration: I enter the OTP-key into the integration, and it is accepted.

  2. Adding OTP-key to OTP App (backup): Additionally, I added the OTP-key to my OTP app, which ensures I have access to the necessary OTP for logging in on the Alexa page (not the Amazon page) with an App-OTP.

  3. Confirming the OTP in the Integration Dialog: Checkmark and done.

  4. Redirect to Alexa Login Page: I am redirected to the Alexa login page in my browser. Here, I need to log in again with a new App-OTP. I need to use my App as there's not another OTP provided by the integration.

  5. Integration Fails: Despite successfully logging in on the Alexa page, the integration ultimately indicates that the login was unsuccessful and fails.

EDIT: After multiple attempts, it finally worked. However, I had to use a new OTP code for step 4 from my Android OTP app. The integration prefilled the previously used OTP code from the earlier dialog, but it should have generated a new one for this step.

EDIT 2: I had to reauthenticate, now it always fails.

@PrathikGopal
Copy link

PrathikGopal commented Aug 4, 2024

Same with amazon.in , reverted back to 4.12.1

@Mally2004uk
Copy link

My workaround, install with hacs Version 4.12.0 and login, After successfull login, Update to current version

I have just tried this and i still get unknown error when trying to login

@danielbrunt57
Copy link
Collaborator

@Mally2004uk Since you've not provided alexa_media & alexapy debug logs, I'm only guessing that you should start with whether your Amazon account works outside of this integration while using the email, password & TOTP/OTP secret that you've specified in the integration. The integration is now working with AMP 4.12.4 plus the files from the latest PR #2398...

@joeuser000
Copy link

joeuser000 commented Aug 5, 2024 via email

@joeuser000
Copy link

joeuser000 commented Aug 5, 2024

Here the log entries for the latest attempt. thanks. I did verify the OTP code btw....sorry for the confusion.

File "/config/custom_components/alexa_media/config_flow.py", line 551, in async_step_totp_register return await self.async_step_start_proxy(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/config_flow.py", line 358, in async_step_start_proxy str(URL(self.config.get(CONF_HASS_URL)).with_path(AUTH_PROXY_PATH)), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 179, in __new__ raise TypeError("Constructor parameter should be str") TypeError: Constructor parameter should be str simdo01-desktop:/config# tail 300 home-assistant.log tail: can't open '300': No such file or directory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/config_flow.py", line 551, in async_step_totp_register return await self.async_step_start_proxy(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/config_flow.py", line 358, in async_step_start_proxy str(URL(self.config.get(CONF_HASS_URL)).with_path(AUTH_PROXY_PATH)), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 179, in __new__ raise TypeError("Constructor parameter should be str") TypeError: Constructor parameter should be str

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Aug 5, 2024

With AMP 4.12.4 + the files from PR#2398?

@joeuser000
Copy link

installed your version. HA CORE log...
2024-08-05 19:02:25.307 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-08-05 19:02:29.041 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'select', 'nest', 'search', 'input_text', 'assist_pipeline', 'stt', 'script', 'input_number', 'weatherflow', 'scheduler', 'wake_word', 'radio_browser', 'local_calendar', 'history', 'brother', 'ibeacon', 'energy', 'blueprint', 'tts', 'spook', 'zwave_js', 'alexa_media', 'counter', 'onboarding', 'mqtt', 'input_select', 'system_health', 'weatherflow_forecast', 'nodered', 'application_credentials', 'tag', 'cast', 'tplink', 'sun', 'file_upload', 'ffmpeg', 'default_config', 'shopping_list', 'sensor', 'number', 'backup', 'hacs', 'intent', 'input_boolean', 'automation', 'met', 'logbook', 'my', 'input_datetime', 'google_translate', 'config', 'ipp', 'bluetooth_adapters', 'mobile_app', 'androidtv_remote', 'input_button', 'zone', 'image_upload', 'persistent_notification', 'person', 'esphome', 'diagnostics', 'scene', 'hardware', 'media_source', 'conversation', 'analytics', 'homeassistant_alerts', 'trace', 'map', 'schedule', 'timer', 'sonos', 'stream', 'device_automation', 'lovelace', 'version', 'homeassistant'} 2024-08-05 19:02:37.479 INFO (MainThread) [homeassistant.setup] Setting up alexa_media 2024-08-05 19:02:37.486 ERROR (MainThread) [homeassistant.setup] Error during setup of component alexa_media File "/config/custom_components/alexa_media/__init__.py", line 136, in async_setup 2024-08-05 19:02:37.501 INFO (MainThread) [homeassistant.setup] Setup of domain alexa_media took 0.01 seconds 2024-08-05 19:12:48.045 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating new login 2024-08-05 19:12:48.046 DEBUG (MainThread) [custom_components.alexa_media.helpers] j***************l@g*******m: Returning uuid {'uuid': '2af6373ab2c04f1a2e651704c949039f', 'index': 0} 2024-08-05 19:12:48.155 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Generating OTP from 387225 2024-08-05 19:13:14.744 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Starting proxy for j***************l@g*******m - amazon.com File "/config/custom_components/alexa_media/config_flow.py", line 551, in async_step_totp_register File "/config/custom_components/alexa_media/config_flow.py", line 358, in async_step_start_proxy

debug log in homeassistant.log
File "/config/custom_components/alexa_media/config_flow.py", line 551, in async_step_totp_register async def async_step_reauth(self, user_input=None): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/config_flow.py", line 358, in async_step_start_proxy self.proxy_view.handler = self.proxy.all_handler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 179, in __new__ raise TypeError("Constructor parameter should be str") TypeError: Constructor parameter should be str

@joeuser000
Copy link

ok.. Update. I restarted a few times and tried again! Success....Not sure why but thank you for your assistant.

dj

@joeuser000
Copy link

wait...i got a success message but go to integrations is says not loaded. will research.

@danielbrunt57
Copy link
Collaborator

Are you still on HA Core: 2024.7.3?

@joeuser000
Copy link

yes....AMP says "Not loaded" in the integrations panel. Nothing apparent in logs

@Mally2004uk
Copy link

@Mally2004uk Since you've not provided alexa_media & alexapy debug logs, I'm only guessing that you should start with whether your Amazon account works outside of this integration while using the email, password & TOTP/OTP secret that you've specified in the integration. The integration is now working with AMP 4.12.4 plus the files from the latest PR #2398...

I am all up and running now. Took me awhile to add the lines from PR #2398

@chrisvblemos
Copy link
Contributor

Domains different from amazon.com are still not working for me.
My best guess is there may be a problem related to the cookies being sent to the urls defined while attempting to get the csrf tokens (inside alexapy).

@danielbrunt57
May I suggest you clear all config entries, .storage, etc and try using a different domain inside AMP (like amazon.com.br or amazon.de) when first setting up AMP?

@danielbrunt57
Copy link
Collaborator

It took me hours of chasing down the missing CONF_HASS_URL but in the end I believe I finally found it.
I was sure I had already changed it but it must reverted during a recent PR revert that Alan had done.

image
Lines 741-742:

        if CONF_HASS_URL in user_input:
            self.config[CONF_HASS_URL] = user_input[CONF_HASS_URL]

@danielbrunt57 danielbrunt57 changed the title Not able to Log In. Unknow Error Occurred Not able to Log In. Unknown Error Occurred Aug 6, 2024
@jleinenbach
Copy link
Contributor

It took me hours of chasing down the missing CONF_HASS_URL but in the end I believe I finally found it. I was sure I had already changed it but it must reverted during a recent PR revert that Alan had done.

Oh no. Right, it was reverted. But it was already fixed in my files when I tested it: amazon.de is still not working for me while amazon.com is working. IDK, but there were so many changes, maybe fix this with a new PR?

@jleinenbach
Copy link
Contributor

Additional Minor Issues Noted During Configuration

  • During reconfiguration, there is no entry for the internal URL.
  • During reconfiguration, users are prompted to include a trailing slash (/) in the URL, whereas during initial configuration, the URL is pre-filled without a trailing slash (/).

@jleinenbach
Copy link
Contributor

I deleted the configuration and the cookie, then it failed for amazon.de again:

2024-08-06 15:31:28.163 DEBUG (MainThread) [alexapy.alexalogin] 5 cookies successfully exchanged for refresh token for domain .amazon.de
2024-08-06 15:31:28.164 DEBUG (MainThread) [alexapy.alexalogin] Attempting to discover CSRF token
2024-08-06 15:31:28.315 DEBUG (MainThread) [alexapy.alexalogin] CSRF token not found from /spa/index.html
2024-08-06 15:31:28.595 DEBUG (MainThread) [alexapy.alexalogin] CSRF token not found from /api/devices-v2/device?cached=false
2024-08-06 15:31:28.660 DEBUG (MainThread) [alexapy.alexalogin] CSRF token not found from /templates/oobe/d-device-pick.handlebars
2024-08-06 15:31:28.725 DEBUG (MainThread) [alexapy.alexalogin] No csrf token found
2024-08-06 15:31:29.170 DEBUG (MainThread) [alexapy.alexalogin] GET: 
https://alexa.amazon.com/api/bootstrap returned 200:OK with response <CIMultiDictProxy('Content-Type': 'application/json', 'Content-Length': '181', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Tue, 06 Aug 2024 13:31:29 GMT', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'x-amz-rid': '9MVHX5Y5SYD7JSDW7MQC', 'Set-Cookie': 'csrf=107031270; expires=Sun, 06-Aug-2034 13:31:28 GMT; Domain=.amazon.com; Path=/', 'x-amzn-RequestId': '9MVHX5Y5SYD7JSDW7MQC', 'x-amzn-alt-domain': 'https://alexa.amazon.de/logout', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 f36453eb82bc9ab0c6e360ac52cc5972.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FRA56-P8', 'X-Amz-Cf-Id': '5KRCnl5fA3NpYtsBuGUg5PO7TD4EweYH71CmqDU-fDndYZ_mGkz23Q==')>
2024-08-06 15:31:29.237 DEBUG (MainThread) [alexapy.alexalogin] GET: 
https://alexa.amazon.de/api/bootstrap returned 401:Unauthorized with response <CIMultiDictProxy('Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Tue, 06 Aug 2024 13:31:29 GMT', 'Strict-Transport-Security': 'max-age=0; includeSubDomains;', 'x-amz-rid': 'EHDMTSEBH2F6FMWEW35B', 'loginUrl': 'https://www.amazon.de/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.de%2Flogin&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_de&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&', 'x-amzn-RequestId': 'EHDMTSEBH2F6FMWEW35B', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 7432b1699c051c0940019ac02d9c3902.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'MUC50-P6', 'X-Amz-Cf-Id': 'M3xxiaasP1M2OqBEEjcUU00puNaq5rw1xQ5DahaEKjVEgzTZHgBYZQ==')>
2024-08-06 15:31:29.238 DEBUG (MainThread) [alexapy.alexalogin] Not logged in: An exception of type ContentTypeError occurred. Arguments:
(RequestInfo(url=URL('https://alexa.amazon.de/api/bootstrap'), method='GET', headers=<CIMultiDictProxy('Host': 'alexa.amazon.de', 'User-Agent': 'AmazonWebView/Amazon Alexa/2.2.556530.0/iOS/16.6/iPhone', 'Accept': '*/*', 'Accept-Language': '*', 'DNT': '1', 'Upgrade-Insecure-Requests': '1', 'Accept-Encoding': 'gzip, deflate, br', 'Cookie': 'at-main=Atza|IwEBIDCZrNmIdg58JWwobvk0YDugVk4C5JiksmsDhCSOaJxOJNh06IoJlZesG4kZSCZt9hd72CtAEqruGWTsVwvgIc7Z3hRV7OgKyhN_7Z9ak4WDPOX1Y23Bu0gWYItDI4iU8PuCMeWyAqqvOSHjPBOrv3ykk-na6s-Py1BjMfk27CSqecyiAEJaW8al5rB2m1HYZVIpVMqqvvs1cByndEdhvhiVRXWmCGdgA1xAZkRUIQEI5S66NuVDt5PAD0EtdQ-2n4D_inlS4aBLFvSX6-VSFIr-GaJi_UexHFEqjkao19Zm4Q; lc-main=de_DE; sess-at-main="\\"0K6FmxT/8t/1pkEb9MMj8MWSirARx8Tbdq+myo/wRNo=\\""; session-id=261-7098128-0755204; session-id-time=2353671088l; session-token=akYPBowaBt6VqunJoXYrWTA1pCIggrBxPqDd6Nfd0oc0IN9moYzRuXntR8I4pbzz65x6DqsTpwX0VO7Pti+gaKDwo9P2w3hAzJ0wevHd94eX7RfZnvNasuANMy0XnCCA6YLB4GMMV9BBrcoFGzGyGWVHx3/bVmFXXPiCM3zQndeZ6l5dVL8+j5agHVnnGudI/vXFEiO6OvZJGxPyG4i4aDKoe7eKf74lQNaTp9GUMQXfcXcvkJK3XaUAK7T/GO9f9AZio+zoT/rEF6JjCLVBp4a3i0/9CFFLifjbbAqwYHuK8b8b89LRxoexnpPPKqp1byImLbHa/zN+U1UxIA2B7CRbIRdRHn2N; sid="\\"+NiqV2RFY5nyghOg8sF8HQ==|KnVxtuH/Gl1KbpMelx5J9LQXjH84Mp02CrJoyL6oX1s=\\""; ubid-acbde=134-1927251-7136836; ubid-main=134-1927251-7136836; x-main="\\"0fD?s68hNBmVcQsICi7oaSSl0T5f4Rjd\\""')>, real_url=URL('https://alexa.amazon.de/api/bootstrap')), ())

According to ChatGPT:

The error occurs because after deleting the configuration and cookies, the authentication for amazon.de fails. Here are some specific points and possible causes:

  1. CSRF Token Not Found:

    • Multiple attempts to discover the CSRF token fail (CSRF token not found). This indicates that the application is having trouble retrieving the necessary security token for authentication.
  2. Different Domains:

    • The response from https://alexa.amazon.com provides a CSRF token for the .amazon.com domain, but the subsequent request is made to https://alexa.amazon.de. This could cause an issue because cookies set for .amazon.com may not be applied to .amazon.de.
  3. Unauthorized Error:

    • The call to https://alexa.amazon.de/api/bootstrap returns a 401 Unauthorized response. This indicates that the authentication was not successful. The 401 response also includes a loginUrl, indicating that re-authentication is required.
  4. Set-Cookie Entries:

    • The response from https://alexa.amazon.com/api/bootstrap includes a Set-Cookie entry for csrf=107031270; expires=Sun, 06-Aug-2034; Domain=.amazon.com; Path=/, confirming that the CSRF token is set for .amazon.com and not .amazon.de.

Possible Solutions:

  1. Check Cookie Domains:

    • Ensure that cookies are correctly set for the appropriate domains. The CSRF token may need to be set for .amazon.de instead of .amazon.com.
  2. Synchronization of Authentication Domains:

    • Verify that the application correctly synchronizes between different Amazon domains (.com and .de). It may be necessary to configure the application specifically for one domain.
  3. Re-Login:

    • The Unauthorized error suggests that the session might be expired or invalid. Re-login via the provided loginUrl could resolve the issue.
  4. Debugging and Logging:

    • Enable detailed debugging and logging to better trace where the authentication process is failing.

By addressing these points, you can potentially identify and fix the issue, ensuring that authentication for amazon.de is successful.

@joeuser000
Copy link

Upgraded to 2024.7.4 and loaded the "patched" AMP. Got through the OTP sign in however APM shows "Not Loaded" in Integrations. Error in logs.

`024-08-06 10:25:12.846 ERROR (MainThread) [homeassistant.setup] Error during setup of component alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/alexa_media/init.py", line 128, in async_setup
for account in domainconfig[CONF_ACCOUNTS]:

KeyError: 'accounts'`

@chrisvblemos
Copy link
Contributor

chrisvblemos commented Aug 6, 2024

Relating to the problem of not being able to login on the AMP if domain is different from amazon.com even with the fixes provided by @danielbrunt57 in his PR #2398 .

I've successfully fixed the problem on my end and I can now login using non .com domains (amazon.com.br, amazon.co.uk, etc). It appears the problem comes from alexapy indeed. I've submitted an issue and a PR to alexapy's repo to see if any of what I'm saying makes sense or not. Let's see if it continues working tomorrow/etc.

Note: this is only for people who are using the AMP fixes mentioned above (the ones from PR #2398) and are still having trouble logging in - specially if your domain is not amazon.com. A temporary fix, if you do not wish to install a custom alexapy with the changes described in the issue I've submitted, you can try logging in with amazon.com domain instead. This might lead to other errors in the integration, as shown by the warning in the logs, so be warned :).

If you have issues while using the PR files or the workaround, it's better to wait for it to be pulled before submitting an issue to keep things organized (since we're technically not using the source code).

@casa3c
Copy link

casa3c commented Aug 6, 2024

It took me hours of chasing down the missing CONF_HASS_URL but in the end I believe I finally found it. I was sure I had already changed it but it must reverted during a recent PR revert that Alan had done.

image Lines 741-742:

        if CONF_HASS_URL in user_input:
            self.config[CONF_HASS_URL] = user_input[CONF_HASS_URL]

This issue is odd. I have restored a backup with the AMP version that you created a few weeks ago in your repository (Alexdanielbrunt57/alexa_media_player (integration) V. 4.10.3) And with that version I am able to carry out the OTP and AMP works in my home assistant perfecly.

image

@moseisleydk
Copy link

On newest HA core, and AMP 4.12.5 - stille have the Error 500 - Server got in trouble..

@jleinenbach
Copy link
Contributor

On newest HA core, and AMP 4.12.5 - stille have the Error 500 - Server got in trouble..

This has nothing to do with the "Unknown error occurred" issue. You should open a new issue.

@danielbrunt57
Copy link
Collaborator

On newest HA core, and AMP 4.12.5 - stille have the Error 500 - Server got in trouble..

And provide your debug logs!!

@alexruffell
Copy link

alexruffell commented Aug 7, 2024

I've tried every 4.12.x version up to the latest .5 but cannot get it to work. I tried removing and readding with reboots in between. I am on the latest 2024.8 HA Core beta too, so I wonder whether my issues have something to do with that too as it appears some are able to get it working, but not all.

image

If I can be of any help with logs, etc. please let me know. Other than that, I'll sit in the sidelines and wait :) - Thanks for the hard work on this integration!

Edit: I am looking at a debug log and see errors related to CSRF tokens not found, and a lot more, however I also see stuff I do not feel comfortable sharing openly (NC HA URL, email used for Amazon login, cookie contents?, etc).

@IsaTTeN
Copy link

IsaTTeN commented Aug 7, 2024

Hi
I just updated HA to 2024.08 and 4.12.5 and now I got the warning.
I deleted the integration and added again with amazon.com and amazon.es but I get the an error after OTP page: Alexa Media "Player can not Log in"
This is the log:
2024-08-07 22:27:59.263 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry blahblah@gmail.com - amazon.es for alexa_media Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/__init__.py", line 359, in async_setup_entry await login.login(cookies=await login.load_cookie()) File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 687, in login post_resp = await self._session.post( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 576, in _request raise err_exc_cls(url) aiohttp.client_exceptions.InvalidUrlClientError: /errors/validateCaptcha

@joeuser000
Copy link

Upgrade HA to 2024.7.4 and installed "patched" AMP. de-installed, deleted pickle files in .storage, restarted HA. re-installed. AMP is now working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue already exists pr-submitted
Projects
None yet
Development

No branches or pull requests