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

failed to SignIn #2407

Closed
ChristophCaina opened this issue Aug 7, 2024 · 56 comments
Closed

failed to SignIn #2407

ChristophCaina opened this issue Aug 7, 2024 · 56 comments
Assignees
Labels
bug Something isn't working

Comments

@ChristophCaina
Copy link
Contributor

Describe the bug
After removing Alexa media Player due to several tests, for the issues the last days, I installed 4.12.5 today.

Unfortunately, it seems that there are configuration issues, depending on the selected amazon Domain.

I can start the login for DE Domain, I am also getting the tfa Page - but the Integration is showing a failure to login in the end of the process.

When I select COM Domain, everything is working and the Integration can login, but no devices we're added.

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Should work independend of the selected amazon Domain.

Screenshots

System details

  • Home-assistant (version): 2024.8.0b4
  • alexa_media (version from const.py or HA startup): 4.12.5
  • alexapy (version from pip show alexapy or HA startup):
  • Amazon 2FA is enabled (y/n): y

Logs
No Logs during Initial setup

Additional context

@danielbrunt57
Copy link
Collaborator

  • alexapy (version from pip show alexapy or HA startup): ???

v1.27.10 or v1.28.1?

@danielbrunt57 danielbrunt57 self-assigned this Aug 7, 2024
@danielbrunt57 danielbrunt57 added the bug Something isn't working label Aug 7, 2024
@Matze89x
Copy link

Matze89x commented Aug 7, 2024

image
Yes, the same here. Today installed the latest version of v4.12.5 to 2024.8.0b5
Alexa Media could not be logged in

@jleinenbach
Copy link
Contributor

jleinenbach commented Aug 7, 2024

This is an alexapy v1.28.1 issue.
There's already a solution by @chrisvblemos:
#2398 (comment)
https://gitlab.com/keatontaylor/alexapy/-/issues/32

alexalogin.py needs to be patched:

fix_cookies.patch

--- /tmp/alexalogin.py.orig
+++ /tmp/alexalogin.py.modified
@@ -1251,10 +1251,11 @@
                     # Strings are returned within quotations, strip them
                     else item["Value"][1:-1]
                 )
-                for name, value in item.items():
-                    if name in ["Name", "Value"]:
-                        continue
-                    raw_cookie[cookie_name][name] = f"{value}; Domain={domain}"
+                raw_cookie[cookie_name]["domain"] = domain
+                raw_cookie[cookie_name]["path"] = item["Path"]
+                raw_cookie[cookie_name]["secure"] = item["Secure"]
+                raw_cookie[cookie_name]["expires"] = item["Expires"]
+                raw_cookie[cookie_name]["httpOnly"] = item["HttpOnly"]                
                 # _LOGGER.debug("updating jar with cookie %s", raw_cookie)
                 self._session.cookie_jar.update_cookies(raw_cookie, URL(domain))
             _LOGGER.debug(

To use "patch" and the patch file above:
apk --no-cache add patch
patch "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py" < "fix_cookies.patch"

To revert the patch:
patch -R "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py" < "fix_cookies.patch"

For v4.12.5, also edit manifest.json to:
"requirements": ["alexapy>=1.28.1", "packaging>=20.3", "wrapt>=1.14.0"],

@xhemp
Copy link

xhemp commented Aug 7, 2024

I have the same, tried to patch alexapy as well to no avail.

1 similar comment
@EBobbbele
Copy link

I have the same, tried to patch alexapy as well to no avail.

@chrisvblemos
Copy link
Contributor

@xhemp @EBobbbele Can you post the log?

@xhemp
Copy link

xhemp commented Aug 7, 2024

@xhemp @EBobbbele Can you post the log?

Sure thing, let me know if this is the right one or you need anything else:

2024-08-07 21:45:50.014 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating new login
2024-08-07 21:45:50.014 DEBUG (MainThread) [custom_components.alexa_media.helpers] *******@*********: Returning uuid {'uuid': 'uuid_number', 'index': 0}
2024-08-07 21:45:50.099 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for ****************************************************
2024-08-07 21:45:50.106 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 000000
2024-08-07 21:45:50.108 DEBUG (MainThread) [alexapy.alexalogin] Login created for email_address - amazon.co.uk
2024-08-07 21:45:50.193 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 000000
2024-08-07 21:45:50.193 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Generating OTP from 000000
2024-08-07 21:45:52.538 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Starting proxy for *******@********* - amazon.co.uk
2024-08-07 21:45:52.539 DEBUG (MainThread) [alexapy.alexalogin] Attempting oauth login to https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:client_id&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=code&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&openid.oa2.code_challenge_method=S256&openid.oa2.code_challenge=ochallenge&language=en_GB
2024-08-07 21:45:52.618 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 000000
2024-08-07 21:45:52.619 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 000000
2024-08-07 21:45:52.670 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Found flow_id; adding 192.168.2.1 to known_ips for 300 seconds
2024-08-07 21:46:00.197 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Checking proxy response for *******@********* - amazon.co.uk
2024-08-07 21:46:00.237 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.co.uk
2024-08-07 21:46:02.977 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.co.uk/auth/register) [200 OK]>
<CIMultiDictProxy('Server': 'Server', 'Date': 'Wed, 07 Aug 2024 20:46:02 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '5794', 'Connection': 'keep-alive', 'x-amz-rid': 'YZ9HKKDJ9E7C5XHRS0TG', 'x-amzn-RequestId': '1ee81e84-c050-4c45-a73e-a79411a938a3', 'X-Amz-Date': 'Wed, 07 Aug 2024 20:46:02 GMT', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload')>
 with
{"requested_extensions": ["device_info", "customer_info"], "cookies": {"website_cookies": [], "domain": ".amazon.co.uk"}, "registration_data": {"domain": "Device", "app_version": "2.2.556530.0", "device_type": "A2IVLV5VM2W81", "device_name": "%FIRST_NAME%'s%DUPE_STRATEGY_1ST%Alexa Media Player", "os_version": "16.6", "device_serial": "dfa66cf453a1d07d9092bab6fb5f8e83", "device_model": "iPhone", "app_name": "Alexa Media Player", "software_version": "1"}, "auth_data": {"client_id": "646661363663663435336131643037643930393262616236666235663865383332333431333234393536346335363335353634643332353733383331", "authorization_code": "ANuPOfmQDrnbEFNtVeqHyiIn", "code_verifier": "jPRKS-zlhKLFm3as21qFkJEYIUSL4RpKPD0U2LzS0Dg", "code_algorithm": "SHA-256", "client_domain": "DeviceLegacy"}, "user_context_map": {"frc": "OJEFiXYmJDdBHDK7YHxl9e5Y7Pi/I+Ry8FDcuo+ESsYJQDTiChHeJTKxl6WL8iVH4OOUI3+/PUBa18lRlU51NicgVU7SWPQKmWXByo2lvAMjF2DmBDRSzJsevd/vWqEa3jmUzE9XsWxlSSDbaKXepnzd3+eRRyxNW0h93/gGIllB5zJZ++BS5y5j1+FBa7A3MWpX4EYCvaDq1GHGwYBFunTpPHRQH3/Lzh4Pmb+MqT4qBPAjBbkR3fq361oAqcrFmG8+8/7npOQfK+junaUfgISHSkOhqYR5blJnsTdUgtnEozMzHKKKmW+UCHjIi50AxocTNVlVRRNIZAJDjpVXd4WJl1NNcz6Nv5+jzu9BVZikDZ/aTSXgKNH6U4Cv/Rn+6x/j+i/bTvdVWCom6jmJyG+Bgcvdi9AwLg"}, "requested_token_type": ["bearer", "mac_dms", "website_cookies"]}
2024-08-07 21:46:02.978 DEBUG (MainThread) [alexapy.alexalogin] Successfully registered  NoOne's Alexa Media Player device with Amazon
2024-08-07 21:46:02.978 DEBUG (MainThread) [alexapy.alexalogin] New access token(396) received which expires at 2024-08-07 22:46:02.978681 in 0:59:59.999959
2024-08-07 21:46:05.021 DEBUG (MainThread) [alexapy.alexalogin] capabilities response <ClientResponse(https://api.amazonalexa.com/v1/devices/@self/capabilities) [204 No Content]>
<CIMultiDictProxy('Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Wed, 07 Aug 2024 20:46:04 GMT', 'x-amz-rid': 'GM9CTSWT0YFDQB3X2Y8P', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 825c353028636ce2c99d8287ac5faf66.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'LHR5-P3', 'X-Amz-Cf-Id': 'wPlkietPKsyTut4gExK8B_odjN5YYSJJcoCu6qp6UjSz7puUGoO2-g==')>
 with
{"legacyFlags": {"SUPPORTS_COMMS": true, "SUPPORTS_ARBITRATION": true, "SCREEN_WIDTH": 1170, "SUPPORTS_SCRUBBING": true, "SPEECH_SYNTH_SUPPORTS_TTS_URLS": false, "SUPPORTS_HOME_AUTOMATION": true, "SUPPORTS_DROPIN_OUTBOUND": true, "FRIENDLY_NAME_TEMPLATE": "VOX", "SUPPORTS_SIP_OUTBOUND_CALLING": true, "VOICE_PROFILE_SWITCHING_DISABLED": true, "SUPPORTS_LYRICS_IN_CARD": false, "SUPPORTS_DATAMART_NAMESPACE": "Vox", "SUPPORTS_VIDEO_CALLING": true, "SUPPORTS_PFM_CHANGED": true, "SUPPORTS_TARGET_PLATFORM": "TABLET", "SUPPORTS_SECURE_LOCKSCREEN": false, "AUDIO_PLAYER_SUPPORTS_TTS_URLS": false, "SUPPORTS_KEYS_IN_HEADER": false, "SUPPORTS_MIXING_BEHAVIOR_FOR_AUDIO_PLAYER": false, "AXON_SUPPORT": true, "SUPPORTS_TTS_SPEECHMARKS": true}, "envelopeVersion": "20160207", "capabilities": [{"version": "0.1", "interface": "CardRenderer", "type": "AlexaInterface"}, {"interface": "Navigation", "type": "AlexaInterface", "version": "1.1"}, {"type": "AlexaInterface", "version": "2.0", "interface": "Alexa.Comms.PhoneCallController"}, {"type": "AlexaInterface", "version": "1.1", "interface": "ExternalMediaPlayer"}, {"type": "AlexaInterface", "interface": "Alerts", "configurations": {"maximumAlerts": {"timers": 2, "overall": 99, "alarms": 2}}, "version": "1.3"}, {"version": "1.0", "interface": "Alexa.Display.Window", "type": "AlexaInterface", "configurations": {"templates": [{"type": "STANDARD", "id": "app_window_template", "configuration": {"sizes": [{"id": "fullscreen", "type": "DISCRETE", "value": {"value": {"height": 1440, "width": 3200}, "unit": "PIXEL"}}], "interactionModes": ["mobile_mode", "auto_mode"]}}]}}, {"type": "AlexaInterface", "interface": "AccessoryKit", "version": "0.1"}, {"type": "AlexaInterface", "interface": "Alexa.AudioSignal.ActiveNoiseControl", "version": "1.0", "configurations": {"ambientSoundProcessingModes": [{"name": "ACTIVE_NOISE_CONTROL"}, {"name": "PASSTHROUGH"}]}}, {"interface": "PlaybackController", "type": "AlexaInterface", "version": "1.0"}, {"version": "1.0", "interface": "Speaker", "type": "AlexaInterface"}, {"version": "1.0", "interface": "SpeechSynthesizer", "type": "AlexaInterface"}, {"version": "1.0", "interface": "AudioActivityTracker", "type": "AlexaInterface"}, {"type": "AlexaInterface", "interface": "Alexa.Camera.LiveViewController", "version": "1.0"}, {"type": "AlexaInterface", "version": "1.0", "interface": "Alexa.Input.Text"}, {"type": "AlexaInterface", "interface": "Alexa.PlaybackStateReporter", "version": "1.0"}, {"version": "1.1", "interface": "Geolocation", "type": "AlexaInterface"}, {"interface": "Alexa.Health.Fitness", "version": "1.0", "type": "AlexaInterface"}, {"interface": "Settings", "type": "AlexaInterface", "version": "1.0"}, {"configurations": {"interactionModes": [{"dialog": "SUPPORTED", "interactionDistance": {"value": 18, "unit": "INCHES"}, "video": "SUPPORTED", "keyboard": "SUPPORTED", "id": "mobile_mode", "uiMode": "MOBILE", "touch": "SUPPORTED"}, {"video": "UNSUPPORTED", "dialog": "SUPPORTED", "interactionDistance": {"value": 36, "unit": "INCHES"}, "uiMode": "AUTO", "touch": "SUPPORTED", "id": "auto_mode", "keyboard": "UNSUPPORTED"}]}, "type": "AlexaInterface", "interface": "Alexa.InteractionMode", "version": "1.0"}, {"type": "AlexaInterface", "configurations": {"catalogs": [{"type": "IOS_APP_STORE", "identifierTypes": ["URI_HTTP_SCHEME", "URI_CUSTOM_SCHEME"]}]}, "version": "0.2", "interface": "Alexa.Launcher"}, {"interface": "System", "version": "1.0", "type": "AlexaInterface"}, {"interface": "Alexa.IOComponents", "type": "AlexaInterface", "version": "1.4"}, {"type": "AlexaInterface", "interface": "Alexa.FavoritesController", "version": "1.0"}, {"version": "1.0", "type": "AlexaInterface", "interface": "Alexa.Mobile.Push"}, {"type": "AlexaInterface", "interface": "InteractionModel", "version": "1.1"}, {"interface": "Alexa.PlaylistController", "type": "AlexaInterface", "version": "1.0"}, {"interface": "SpeechRecognizer", "type": "AlexaInterface", "version": "2.1"}, {"interface": "AudioPlayer", "type": "AlexaInterface", "version": "1.3"}, {"type": "AlexaInterface", "version": "3.1", "interface": "Alexa.RTCSessionController"}, {"interface": "VisualActivityTracker", "version": "1.1", "type": "AlexaInterface"}, {"interface": "Alexa.PlaybackController", "version": "1.0", "type": "AlexaInterface"}, {"type": "AlexaInterface", "interface": "Alexa.SeekController", "version": "1.0"}, {"interface": "Alexa.Comms.MessagingController", "type": "AlexaInterface", "version": "1.0"}]}
{"User-Agent": "AmazonWebView/Amazon Alexa/2.2.556530.0/iOS/16.6/iPhone", "Accept-Language": "en-US", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-type": "application/json; charset=UTF-8", "authorization": "Bearer Bearer_Auth"}
2024-08-07 21:46:05.280 DEBUG (MainThread) [alexapy.alexalogin] 5 cookies successfully exchanged for refresh token for domain .amazon.co.uk
2024-08-07 21:46:05.283 DEBUG (MainThread) [alexapy.alexalogin] Attempting to discover CSRF token
2024-08-07 21:46:05.395 DEBUG (MainThread) [alexapy.alexalogin] CSRF token not found from /spa/index.html
2024-08-07 21:46:05.564 DEBUG (MainThread) [alexapy.alexalogin] CSRF token not found from /api/devices-v2/device?cached=false
2024-08-07 21:46:05.618 DEBUG (MainThread) [alexapy.alexalogin] CSRF token not found from /templates/oobe/d-device-pick.handlebars
2024-08-07 21:46:05.666 DEBUG (MainThread) [alexapy.alexalogin] No csrf token found
2024-08-07 21:46:05.950 DEBUG (MainThread) [alexapy.alexalogin] GET:
https://alexa.amazon.com/api/bootstrap returned 200:OK with response <CIMultiDictProxy('Content-Type': 'application/json', 'Content-Length': '171', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Wed, 07 Aug 2024 20:46:05 GMT', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'x-amz-rid': 'CCNYHKZ31D1CZ5HBVNKG', 'Set-Cookie': 'csrf=-1096431112; expires=Mon, 07-Aug-2034 20:46:05 GMT; Domain=.amazon.com; Path=/', 'x-amzn-RequestId': 'CCNYHKZ31D1CZ5HBVNKG', 'x-amzn-alt-domain': 'https://alexa.amazon.co.uk/logout', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 bb2554f7baaaf76b8275e54a76206d98.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'LHR61-P6', 'X-Amz-Cf-Id': 'SdQlWAxPWZ0_P9bhMM7uS9EWjt5RqxgCwTYSIlc0NjI8VeuE5vJOZQ==')>
2024-08-07 21:46:05.987 DEBUG (MainThread) [alexapy.alexalogin] GET:
https://alexa.amazon.co.uk/api/bootstrap returned 401:Unauthorized with response <CIMultiDictProxy('Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Wed, 07 Aug 2024 20:46:05 GMT', 'x-amz-rid': 'EC64MRBSC2JKQXMGDAY8', 'loginUrl': 'https://www.amazon.co.uk/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.co.uk%2Flogin&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_uk&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': 'EC64MRBSC2JKQXMGDAY8', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Strict-Transport-Security': 'max-age=0; includeSubDomains;', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 643f3a19739b50ef1fffa170c9395e24.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'LHR50-P7', 'X-Amz-Cf-Id': '5eD3Hqm4hcAft_9PQS0b4jlCIVFkXen9-Py_moy_-IGRjMsh_rfWiA==')>
2024-08-07 21:46:05.989 DEBUG (MainThread) [alexapy.alexalogin] Not logged in: An exception of type ContentTypeError occurred. Arguments:
(RequestInfo(url=URL('https://alexa.amazon.co.uk/api/bootstrap'), method='GET', headers=<CIMultiDictProxy('Host': 'alexa.amazon.co.uk', '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|IwEBIN9YsSzUEfkHvR0lviSzsWkAEMT3fbnJOiW2ZgCohQJO4JzhK8_UqzYQoz_-IJxc_4XEeDp26OsVHJLoj4ovCt1DDMuRMo1Ll4SvvIbGBHdAjzo2GabVRhknKoYuTHMz_mA5v4kyNFl6UJJxvBoL4D_jlt_A8vqbW8GLutim8W2gJlhzGwofdRDcEAn-8jOJvsUTa5Rlr2QFT1feus3zTiPKjuhtA1-jgwQuy97qbnL7hp9RGrxFMzC6Uj0yaATPyTmuq38f9k_hjRRZr2ZZwarBMOWNjvtbdK48lw0psPvrXg; lc-main=en_GB; sess-at-main="\\"pjCwZWYG0gtJD5iu4ISa6v70TFs957fj2/jlPNfGEuM=\\""; session-id=261-1025781-3338869; session-id-time=2353783565l; session-token=aBPNtm4/8kmR89lhdMutURJ9iPtrAhZ14lvLoLQCrDKt0MVIG30wiBTRScN5szxmlaarhFzg9IFBO8I7ncKsIbIfkDFA4jX4tQOhI4x0wY7X4QlHPz12PB7QB00lUEzUtY71YfnUHjrkItNtPLul0u4TTSgTrZVe3IF6BsHETcOb2r+knh9LE9Yu9wBZ/nRPZM69kxwTSlwNOw7Ndy+NKzVPMH6AaJb+4Ero+OBSPxmnlvlMoKGDRRsbxjH+8U8aGyId4uv0FIlUlVrIQdhUImHMmMY98PToFwEXfzfPBAvbvTO3eQisXoPa3cVjNGHf+tQdZ+Ccfeq5hzzbO0Dk7DYWMaWMCDFLFUaVwKkDlsIBVmAqEObFTB+GTzRwmhTcCD3wZRucN7w=; sid="\\"j7d2nkpTHhVSnV61ZSoTyg==|AUjN5KRFVI+IeWqPzWON5SlKMYitKx3UTPaALb0/k+A=\\""; ubid-acbuk=131-7439259-8292637; ubid-main=131-7439259-8292637; x-main=hEKVRpdvjepBsE6HHtYLi486snlkEMnt')>, real_url=URL('https://alexa.amazon.co.uk/api/bootstrap')), ())

@dharvey242
Copy link

Exact same problem for me. Domain related. .com works fine but I need amazon.co.uk.

@chrisvblemos
Copy link
Contributor

chrisvblemos commented Aug 7, 2024

@xhemp @EBobbbele Can you post the log?

Sure thing, let me know if this is the right one or you need anything else:

@xhemp

Either the patch wasn't applied successfully or there is another issue. To make sure you are using the patch provided by jleinenbach, try to repeat the proccess but instead using the following patch file with additional logging:

--- /tmp/alexalogin.py.orig
+++ /tmp/alexalogin.py.modified
@@ -1251,10 +1251,12 @@
                     # Strings are returned within quotations, strip them
                     else item["Value"][1:-1]
                 )
-                for name, value in item.items():
-                    if name in ["Name", "Value"]:
-                        continue
-                    raw_cookie[cookie_name][name] = f"{value}; Domain={domain}"
+                raw_cookie[cookie_name]["domain"] = domain
+                raw_cookie[cookie_name]["path"] = item["Path"]
+                raw_cookie[cookie_name]["secure"] = item["Secure"]
+                raw_cookie[cookie_name]["expires"] = item["Expires"]
+                raw_cookie[cookie_name]["httpOnly"] = item["HttpOnly"]
+                _LOGGER.warning("Adding new cookie using alexapy's patch: %s", raw_cookie)
                 # _LOGGER.debug("updating jar with cookie %s", raw_cookie)
                 self._session.cookie_jar.update_cookies(raw_cookie, URL(domain))
             _LOGGER.debug(

Check your logs again afterwards. Multiple warnings should show up if the patch was applied:

_LOGGER.warning("Adding new cookie using alexapy's patch: %s", raw_cookie)

Note: this is a workaround and not an official patch. We need to wait for pull requests for alexapy and AMP for the proper fixes, making these patches unnecessary.

@SmarthomeBot
Copy link

image Yes, the same here. Today installed the latest version of v4.12.5 to 2024.8.0b5 Alexa Media could not be logged in

I have the same issue on v4.12.6 (latest version at the time of writing)

@saschaabraham
Copy link

This was fixed in this release of the lib: https://gitlab.com/keatontaylor/alexapy/-/releases/v1.28.2
But the Alexa Media Player needs to update its dependecies to get this version....

@isibizi
Copy link

isibizi commented Aug 8, 2024

Login to Amazon.com is working, Amazon.de is not working

@SuperKali
Copy link

Hello, same problem here in amazon.it

@richwalker1988
Copy link

richwalker1988 commented Aug 8, 2024

This was fixed in this release of the lib: https://gitlab.com/keatontaylor/alexapy/-/releases/v1.28.2 But the Alexa Media Player needs to update its dependecies to get this version....

Same Issues using .co.uk, How do we update?

@ChristophCaina
Copy link
Contributor Author

Same Issues using .co.uk, How do we update?

You can try to modify the manifest.json from alexa_media_player in your custom_components folder to use alexapy 1.28.2 instead of the current version that's given there

@pedolsky
Copy link

pedolsky commented Aug 8, 2024

I can't get my head around it anymore. So we should wait for dependencies update?

@IT-Fuzzi
Copy link

IT-Fuzzi commented Aug 8, 2024

Yes, I guess the code owner will update the dependency shortly. It was just fixed about 1 hour ago in alexapy, just be patient for some more minutes or couple of hours until the official dependency update. ;-)

@dreimer1986
Copy link

Two ways... Wait for an update, or:

Open /homeassistant/custom_components/alexa_media/manifest.json in File Editor Addin and change line 11 to:
"requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],

@saschaabraham
Copy link

After changing the manifest and activating 2FA it worked without any problems using the DE- Domain.

@scm7ak
Copy link

scm7ak commented Aug 8, 2024

Two ways... Wait for an update, or:

Open /homeassistant/custom_components/alexa_media/manifest.json in File Editor Addin and change line 11 to: "requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],

worked a treat! thank you!

@pedolsky
Copy link

pedolsky commented Aug 8, 2024

OH-MY-GOD - it's back!

@SuperKali
Copy link

1.28.2

Works here

@knuti1960
Copy link

alexapy>=1.28.2

That's it, thank you!

@nephrotranz
Copy link

"alexapy>=1.28.2"

This also did the trick for me. Thanks!

@LorenzoRogai
Copy link

@NdR91 It's working fine for me after 4.12.6 and after i re-applied the manifest.json patch (+ restarted HA)

@nephrotranz
Copy link

For other users: this will work only on AMP 4.12.5. I tested this workaround in AMP 4.12.6, and this is not working

Works on 4.12.6 for me.

@pedolsky
Copy link

pedolsky commented Aug 8, 2024

For me this trick dosen't work :( changing manifest and activatig 2FA show's 0 entities xD using via amazon.com but activate in PL :(

@kczerniak - did you update alexapy to 1.28.2? What do you mean with 'using via amazon.com but activate in PL'?

@rahimahmed
Copy link

rahimahmed commented Aug 8, 2024

i can confirm the fix is working > applied the text in red > save config > rebooted > no 2FA needed for me. Amazon.co.uk > annoucement working again - Phew! Thanks dreimer1986
Screenshot_39

@balubone
Copy link

balubone commented Aug 8, 2024

Working for me with domain amazon.it.
You are a hero...

@ChristophCaina
Copy link
Contributor Author

pr available but waiting merge: #2423

@am0jackson
Copy link

Can confirm that editing the manifast.json to 1.28.2 is the correct workaround!

@click2saurabh
Copy link

Worked for me...after editing manifest.json and changing to alexapy>=1.28.2. Needed a re-start of HA though

@xekil
Copy link

xekil commented Aug 8, 2024

Yes, I guess the code owner will update the dependency shortly. It was just fixed about 1 hour ago in alexapy, just be patient for some more minutes or couple of hours until the official dependency update. ;-)

Worked for me...!! Thanks

@richmann03
Copy link

well played. thx. what about furture updates of alexa media player? will it continute working?

@danielbrunt57
Copy link
Collaborator

what about future updates of alexa media player? will it continue working?

Sorry, I seem to have misplaced my crystal ball...

@ziaolino
Copy link

ziaolino commented Aug 8, 2024

Works with FR domain. Thanks for the workaround, much appreciated!

@msaario
Copy link

msaario commented Aug 8, 2024

I got it working too but looks like need to reauthenticate after every restart.

@ChristophCaina
Copy link
Contributor Author

I got it working too but looks like need to reauthenticate after every restart.

It would be good, If you could track this in a seperate issue and provide Log Files when this Happens again.

There were a couple of areas that had to be changed in the last days - so it is likely that Something with saving the cookies or similar dies mit Work...

Especially, when the Last Change in alexapy is related to partitioned cookies

@knuti1960
Copy link

I got it working too but looks like need to reauthenticate after every restart.

I can't confirm this for myself here, it runs even after several restarts.

@mazdarx2001
Copy link

Two ways... Wait for an update, or:

Open /homeassistant/custom_components/alexa_media/manifest.json in File Editor Addin and change line 11 to: "requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],

This worked like a charm and was easy for a noob like me. Thank!! can confirm for anyone that I made this small change and then saved the file, then updated ha core to 2024.8.0 and Alexa Media is working fine

@cydiatec
Copy link

cydiatec commented Aug 8, 2024

Same here! I can confirm that editing the manifast.json to 1.28.2 works for me!

@Javisen
Copy link

Javisen commented Aug 8, 2024

Updated and fixed the manifest.json and everything is fine but voice notifications are not working for me.
Everything is working fine now. I didn't reboot. Sorry.
Voice notifications not working. Need reload integration but after a while they stop working

@tplas
Copy link

tplas commented Aug 8, 2024

alexapy>=1.28.2

Worked for me. Oddly enough, it didn't work when I restarted HA, but I then did "Reload" of the integration, and it came right up. Thanks much, everyone!

@alandtse alandtse closed this as completed Aug 8, 2024
@mazdarx2001
Copy link

mazdarx2001 commented Aug 9, 2024 via email

@danielbrunt57
Copy link
Collaborator

Voice notifications not working. Need reload integration but after a while they stop working

I'd need to review your debug logs.

@joelez83
Copy link

joelez83 commented Aug 30, 2024

Two ways... Wait for an update, or:

Open /homeassistant/custom_components/alexa_media/manifest.json in File Editor Addin and change line 11 to: "requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],

Thanks a lot! I was getting crazy…You’re a hero!

@maxpatrone
Copy link

I've modified the .json as following ... AMP Integration 1.12.12. It doesn't work and it doesn't let me even to login in (after inserting username and password, it rolls back to username and cycles)

{
"domain": "alexa_media",
"name": "Alexa Media Player",
"codeowners": ["@alandtse", "@keatontaylor"],
"config_flow": true,
"dependencies": ["persistent_notification", "http"],
"documentation": "https://github.com/alandtse/alexa_media_player/wiki",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
"loggers": ["alexapy", "authcaptureproxy"],
"requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.12.12"
}

any hints ?

@danielbrunt57
Copy link
Collaborator

@maxpatrone
Try shift-reload the HA browser page and then try re-adding the integration.

@skydado
Copy link

skydado commented Sep 16, 2024

Same here: after OTP succesfully authenticates, it opens the Alexa login webpage and it loops there, asking user+pwd again and again.
Already tried:

  • with different browsers/computer
  • reinstalling Alexa Media Player
  • checking ip_bans.yalm for banned IPs
  • amazon.com domain does the same (I'm on amazon.it)
    Desperately seekeing help after tons of tests ...

@jleinenbach
Copy link
Contributor

jleinenbach commented Sep 16, 2024

Same here: after OTP succesfully authenticates, it opens the Alexa login webpage and it loops there, asking user+pwd again and again. Already tried:

I'm quite sure that Amazon changed the HTML code, so Alexapy has minor issues. With Daniel's workaround, a website opens with HTML code that works for Alexapy.

But this issue 2407 is a different one.
Your issue can be found here: #2514

@skydado
Copy link

skydado commented Sep 16, 2024

Same here: after OTP succesfully authenticates, it opens the Alexa login webpage and it loops there, asking user+pwd again and again. Already tried:

I'm quite sure that Amazon changed the HTML code, so Alexapy has minor issues. With Daniel's workaround, a website opens with HTML code that works for Alexapy.

But this issue 2407 is a different one. Your issue can be found here: #2514

Same here: after OTP succesfully authenticates, it opens the Alexa login webpage and it loops there, asking user+pwd again and again. Already tried:

I'm quite sure that Amazon changed the HTML code, so Alexapy has minor issues. With Daniel's workaround, a website opens with HTML code that works for Alexapy.

But this issue 2407 is a different one. Your issue can be found here: #2514

Thank you so much, I didn't find it by myself. Tried the workaround mentioned there and it works. Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests