madmachinations / home-assistant-alexa-shopping-list

A custom component for Home Assistant which synchronises your Alexa Shopping List
GNU General Public License v3.0
32 stars 3 forks source link

Passkeys cause authentication to fail #11

Open madmachinations opened 2 months ago

madmachinations commented 2 months ago

There are problems with the authentication flow on the italien version of the amazon site, as the remember me checkbox perhaps is missing?

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="rememberMe"]"}

@KiraPC Can you please login to your account in a private browser window, and see if there is a "remember me" checkbox anywhere on the username or password screen?

madmachinations commented 2 months ago

Not sure if anyone saw that comment I just removed, but absolutely do not install whatever that linked to :rofl:

KiraPC commented 2 months ago

I found the problem.

I started the server locally, removed the selenium headless flag and figured out the problem was the passkey configured on my account.

Basically if you have a passkey enabled, browser will open a window asking you the passkey instead of the password.

I removed the passkey and it worked.

Anyway, You should look on selenium if there is a possibility to avoid browser asking for passkey.

Another thing is: if I restart the add-on, I'll lost all the configuration, so I need to do again the "authorization" process. Isn't?

I suggest you to rename the issue in: Can't login if passkey configured!

madmachinations commented 2 months ago

Oh it lost it's config? Did you restart it or remove it and re-add it?

The hass add-on config specifies it wants a persistent directory on the host. So I wonder if hass removes it in certain cases, like if you remove and re-add it, or maybe there's a "reset" button or something that makes hass wipe the data instead of just restarting the container?

I don't know much about hass OS unfortunately, I only used it once briefly.

After logging in though, if you use the list command, did you see your shopping list items in the terminal?

madmachinations commented 2 months ago

Passkeeeeeeeeeeeys, right, I'll have a stab with that also and see if there's something that can be done. Short term I guess I can just stuff that in the docs

KiraPC commented 2 months ago

Oh it lost it's config? Did you restart it or remove it and re-add it?

The hass add-on config specifies it wants a persistent directory on the host. So I wonder if hass removes it in certain cases, like if you remove and re-add it, or maybe there's a "reset" button or something that makes hass wipe the data instead of just restarting the container?

I don't know much about hass OS unfortunately, I only used it once briefly.

After logging in though, if you use the list command, did you see your shopping list items in the terminal?

I just restarted it, I don't know what the button does, but it destroyed the old container and created a new one.

I saw the containerId changed.

Yes, the list command worked, and the integration correctly configured. But I have the shopping list not populated yet.

madmachinations commented 2 months ago

I've added another issue for the config data persistence https://github.com/madmachinations/home-assistant-alexa-shopping-list/issues/12

madmachinations commented 2 months ago

If you go into the dev tools on HA, there is a service, just search the services for alexa and it will come up. That will force a sync job

madmachinations commented 2 months ago

When you configured the custom component, did you put the IP of your hass device in on the LAN? Or did you use "localhost"? Or did you use some virtual IP for the container? Out of curiosity

KiraPC commented 2 months ago

If you go into the dev tools on HA, there is a service, just search the services for alexa and it will come up. That will force a sync job

I did it, but still 0 items in the list

When you configured the custom component, did you put the IP of your hass device in on the LAN? Or did you use "localhost"? Or did you use some virtual IP for the container? Out of curiosity

I just wrote 'python client.py' and it used the default

madmachinations commented 2 months ago

No I mean, when you went into integrations on HA and setup the component, it asks you for an IP and port etc. That IP I mean.

madmachinations commented 2 months ago

Just wondering if it's latched onto a temporary or otherwise unreliable address

KiraPC commented 2 months ago

oh, I used localhost

madmachinations commented 2 months ago

I mean, it should work, but I'm not sure about how HASS restricts things. Try using the static IP of your hass device on your lan instead of localhost. The add-on is configured to open the port to the LAN.

madmachinations commented 2 months ago

Worth a shot, considering how little I know about HASS OS' esoteric bits :P