alexa_media_player: Endless authentication requests for EU domains due to 500 error
Describe the bug An endless request of auth is happening on AMP @amazon.it.
Alexa Media Reauthentication Required
Reauthenticate [](mailto:omissis) on the [Integrations](https://omissis:8123/config/integrations) page. Relogin required after 0:00:13.833459 and 15 api calls.
To Reproduce
System details
- Home-assistant (version): 2022.7
- Hassio (Yes/No): NO (Core@Docker)
- alexa_media (version from
const.py
or HA startup): 4.10 - alexapy (version from
pip show alexapy
or HA startup): 1.26.1 - Amazon [2FA is enabled]: Yes
Logs
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f8ced65f070>,), {}): An error occured accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
Additional context Started a couple of days ago.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 67
- Comments: 151 (5 by maintainers)
Guys, no use saying I have the same problem. Just subscribe to the issue here to get updates and I am pretty sure it will be looked at.
Ok. Please do not add comments unless you’re adding something. Me too posts need to be a +1 on the original issue. It looks like it’s Europe mainly as US isn’t seeing anything. However, I can’t figure out the cause without someone posting the alexapy logs and the result from Amazon causing the reauth requirement. If the me too posts continue, I’ll have to lock the thread since stuff is being buried.
Same problem here, via UK Amazon
Guys as you can see the problem occur in different method of the integration, there is some fields returned from Amazon that it is null and offend the integration, I do not thing the regenerating configurations and keys can help, we need this issue will be fixed at integration level I suppose
authentication issue started happening again, anyone else experiencing this ?. i am on 4.1.1. worked fine for over 12hours but several reuqests since this afternoon ( based in UK)
I did it once again and switched on extended debugging and got the following:
Maybe helpful.
No way. Even with the latest version I had to reauthenticate two times. It seems that it works for a while then is fail again. I’ll try to enable alexapy logging to give more info to @alandtse
i registred a fresh 2FA app and used a new Key code when adding the config. so far (10hr +) it seems to be working and is persistent between restarts aswell. i am not sure if that makes any difference or if it will stick but so far so good.
Looks like it may be intermittent? Mine initially started logging the same error (as reported previously), then a few minutes later was ok again, I rebooted, it failed, then it managed to connect again. I’ve seen the same behaviour over the last hour or so, but seems to have stabilised again. Note @alandtse comments earlier, 500 is an internal server error - so if things are failing/changing at Amazon then we would see this behaviour intermittently - It might be helpful if the 500 error failed more gracefully and reported an error at Amazon (or waited a while before going red and asking for re-auth) - but given it’s a new thing, hard to code against.
An error occured accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('Constructor parameter should be str',)
4.1.1 seems working fine (Italy) - at least about the auth. Btw no retrived data as expected.
Ok, turns out the 500 is likely the cause. Have a fix inbound to ignore it from now on. Please note that if there’s a 500 error, this may mean we won’t get any updated data on a playing Media player since it looks tied to the webplayer. This may be a hint that Amazon is going to deprecate alexa.amazon.com (at least in Europe) which is the main way we access info.
Thanks. 500 errors won’t require a relogin. With debug logs enabled on alexapy and alexa_media, look for the line where it says a reauth is required and then what happens right before it. That’s what I need to figure out why it’s closing out.
This is interesting and may be something we need to fix. However, I’ll need the logs leading up to here as it’s not clear what is causing this error.
@alandtse is usually very active with the development of this addon. He will probably not be reachable. Let’s give him some time to hear about this problem.
+1 spain amazon.es
Hi guys
This automation can help a bit in the mean time
Same here, Amazon.it seems like json reply is different from expected. It seems a server side change that require a patch in this integration.
Could also be that something had been changed server side and to be changed within the API. And “anytime” does not mean every time 🙄