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

500 Internal Server Error after successful OTP Authentication due to missing alexapy #1825

Closed
cvladan opened this issue Jan 13, 2023 · 8 comments
Labels
haissue Issue in Home Assistant

Comments

@cvladan
Copy link

cvladan commented Jan 13, 2023

After successfully completing Amazon OTP Authentication, I am encountering a 500 Internal Server Error. This error occurs during the installation process, and is preventing the installation from completing successfully. I have confirmed that Amazon authentication has been completed without errors.

Expected Result

The installation process should complete successfully, without encountering any errors.

Environment
OS: Windows 11, 10.0.22621 Build 22621
Browser: Firefox 109.0b9
Home Assistant version: 2023.1.2
alexa_media: 4.5.0
alexapy: didn't have it, but later I installed 1.26.4
AppDaemon: v0.11.0
Amazon 2FA: enabled, using Authenticator App

Thanks for your help in advance.

@cvladan
Copy link
Author

cvladan commented Jan 13, 2023

I have resolved the issue, somehow!

I wanted to intentionally create a separate ticket so that someone would notice this problem, as I was very frustrated that I couldn't even try out this component. So, to fill out a new bug report, it is necessary to enter the version of the python library that you get from 'pip show alexapy'. And that's how I noticed that I don't have that library at all.

Yes, it turned out that I don't have that library installed, but I don't know why or how.

The solution is, of course, to enter 'pip install alexapy' in the terminal, for what I've used the official addon SSH & Web Terminal.

I'm aware that if I had wanted to debug the problem I would probably have seen a message that this library was missing.
I now think that installing this library is a resolution to my problem - and it is a huge bug that the author really needs to fix.

Again, a new error?

After that, I was getting the error "Invalid Build-In 2FA key," again, I have no idea why.

Finally, I succeeded

In the end, I succeeded by switching to a new browser, but this time I added the integration using the internal HA address as the IP, in my case it looks like http://192.168.0.111:8123/. Everything worked as if nothing had happened.

Instead of conclusion

In conclusion,

  1. Manually install the Python library with pip install alexapy
  2. Use the internal HA address, not the external one

Important reminder

Additionally, I want to remind everyone that if you are ever presented with the field Built-in 2FA App Key (automatically generate 2FA Codes) , that field actually SHOULD NOT be filled in and it should be left blank. Sometimes it would randomly show up for me and naively I would enter the code from the authenticator and of course, I would get the message "Invalid Built-In 2FA key."

Earlier, there was already a discussion about this and many correctly suggested that this field be renamed or somehow indicated that it is only "special case".

@poulti
Copy link

poulti commented Jan 13, 2023

About the field Built-in 2FA App Key (automatically generate 2FA Codes): it should be the key to generate codes. You get the key when you setup the authenticator (this is what the QR code contains).
For me it's 52 characters long (numbers and caps) - not the 6 digits 2FA code.

@alandtse alandtse changed the title 500 Internal Server Error after successful OTP Authentication 500 Internal Server Error after successful OTP Authentication due to missing alexapy Jan 14, 2023
@alandtse alandtse added the haissue Issue in Home Assistant label Jan 14, 2023
@alandtse
Copy link
Owner

Missing alexapy is an HA issue. I believe it may actually happen because upgrades of HA will wipe out any dependencies and HA does not always reinstall custom component dependencies until you add it again. I believe if you try to add the integration it should auto install, if not, you can manually install.

I'm glad you figured it out as a likely cause of the 500, but at least for this cause, I can't fix it because the issue is in HA's dependency management. There were other reasons for the 500 on the other thread so I'll leave that one open but for the missing alexapy, I'll close this as resolved. Hopefully someone can add the specific error message for this error case and we can update the title to make it searchable.

@lennarto
Copy link

lennarto commented Jan 4, 2024

For me, I didn't need to re-install anything. I just needed to re-login via the local IP address (neither nabu case, nor homeassistant.local did work, but the local IP did work !!)

@xSiderfa
Copy link

xSiderfa commented Jan 7, 2024

For me, neither with local IP adress, nor with the option http://homeassistant.local:8123/. I always get the same error message

@andrezstar2
Copy link

same here

@gayanll
Copy link

gayanll commented Mar 2, 2024

same issues

@sblessley
Copy link

Same. Tried Nabu Casa, local IP, cloudfare'd address. Installed the recommended Python library. Had never used the 2FA settings; that's next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
haissue Issue in Home Assistant
Projects
None yet
Development

No branches or pull requests

8 participants