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

Authentication fails #25

Closed
gargahcerk opened this issue Oct 14, 2024 · 25 comments
Closed

Authentication fails #25

gargahcerk opened this issue Oct 14, 2024 · 25 comments
Assignees
Labels
bug Something isn't working deployed - testing required

Comments

@gargahcerk
Copy link

When authenticating with clients.py I get "Server is authenticated", but when I run the list command immediately after, I get "ERROR: not authenticated". HA integration is not working well due to missing authentication. What can I do?
I try it on amazon.de and Im not asked for OTP, which should be asked for.

@madmachinations
Copy link
Owner

Can you confirm which version of amazon you are trying to use please?

@madmachinations
Copy link
Owner

Can you also please confirm wether when you connected with the client, it asked you to login. Or if it just said it was authenticated and didn't ask for any of that.

@madmachinations madmachinations added help wanted Extra attention is needed question Further information is requested unverified bug Unverified bug and removed help wanted Extra attention is needed labels Oct 14, 2024
@mullanasruddin
Copy link

Can you also please confirm wether when you connected with the client, it asked you to login. Or if it just said it was authenticated and didn't ask for any of that.

I also have this issue. In my case, it asks to login, after typing in the credentials it authenticates without problems....but immediately after searching for the list, it says 'not authenticated'.

@madmachinations
Copy link
Owner

Can you also please confirm wether when you connected with the client, it asked you to login. Or if it just said it was authenticated and didn't ask for any of that.

I also have this issue. In my case, it asks to login, after typing in the credentials it authenticates without problems....but immediately after searching for the list, it says 'not authenticated'.

Did it ask you for an MFA code after you typed your username and password?

Do you have MFA on your account? Do you have a passkey setup at all?

@mullanasruddin
Copy link

Yes, I have MFA and passkey.
No, it doesn't ask for a MFA code.

@madmachinations
Copy link
Owner

Yes, I have MFA and passkey. No, it doesn't ask for a MFA code.

Passkey will be stopping you from authenticating I think, that is a reported thing #11

@madmachinations
Copy link
Owner

If there is one on your account, I think it asks if you want to use it and the structure of the login process changes as a result.

@mullanasruddin
Copy link

I was finally able to get the list of items of my shopping list. I looked in my passkey manager and recognized that I have two different passwords for amazon, one for the amazon shopping app, and the other for the alexa app.
I had to choose the alexa app password. Then it asked for the mfa code.

@Geekerbyname
Copy link

Hey @madmachinations I have a similar issue.

I'm running HA on Docker (host networking) and home-assistant-alexa-shopping-list on a docker network.

Running python3 client.py 192.168.xx.x connects to the server,
intially asks me for the amazon server (amazon.co.uk)
Tells me it's not authenticated and prompts for creds

I then get no MFA prompt but the following output

Traceback (most recent call last): File "/home/jamie/ha/alexa-list-server/client/client.py", line 288, in <module> asyncio.run(client.run_console()) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/jamie/ha/alexa-list-server/client/client.py", line 259, in run_console await self._check_server() File "/home/jamie/ha/alexa-list-server/client/client.py", line 84, in _check_server await self._setup_server_authentication() File "/home/jamie/ha/alexa-list-server/client/client.py", line 131, in _setup_server_authentication response = await self._send_command("login", email=email, password=password) File "/home/jamie/ha/alexa-list-server/client/client.py", line 39, in _send_command response = await websocket.recv() File "/home/jamie/.local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 564, in recv await self.ensure_open() File "/home/jamie/.local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 940, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: received 1011 (internal error); then sent 1011 (internal error)

@madmachinations
Copy link
Owner

This fix should be dealt with by the block of work being done this weekend as part of #31

@madmachinations madmachinations added bug Something isn't working deployed - testing required and removed question Further information is requested unverified bug Unverified bug labels Jan 4, 2025
@madmachinations
Copy link
Owner

Hello, please try again with the latest version.

A number of changes have been made, not all of them deployed. But a fix for the authentication issues should be out in the latest version.

It is important you delete any running version of the server you might currently have, and scrub out any of it's persisted cached files to ensure a clean slate. Then install the latest version from scratch.

You will also need to download the latest client script from this repository.

If you are using the server as a HASS Add-on, you should also delete the custom repository you added to install the add on, as this has now moved to here:

https://github.com/madmachinations/home-assistant-alexa-shopping-list/releases

So you will need to setup the new repository and install the new server version from there.

As part of the changes I have migrated the build process over to github actions and I have added some extra provisions which made it irritating to deploy changes before. So moving ahead:

  • There will be a new release on the releases page for each version, where you can always access the historical project files and client for specific versions. These are being created automatically when a new build is put out
  • When a new version is released, the HASS add-on repository is being automatically updated also. Which should flag new server versions to everyone's HASS installations and prompt you to update.

@madmachinations madmachinations self-assigned this Jan 4, 2025
@nlenevez
Copy link

nlenevez commented Jan 4, 2025

Latest version is not working on amazon.com.au. It prompts for e-mail and password and then says it is authenticated. Does not prompt for MFA although I do receive the MFA code via SMS.

Trying 'list' then just says "ERROR: Not authenticated":

Attempting to connect to ws://10.192.200.5:4000
Connected successfully

Checking config
Config is valid

Checking authentication
Server is not authenticated with Amazon, beginning login...

Enter your Amazon login details
Email address: xxxxxxxx
Password: xxxxxxxxxxxxx
Server is authenticated

Type 'help' for commands.

> list
ERROR: Not authenticated
> 

@madmachinations
Copy link
Owner

Latest version is not working on amazon.com.au. It prompts for e-mail and password and then says it is authenticated. Does not prompt for MFA although I do receive the MFA code via SMS.

Trying 'list' then just says "ERROR: Not authenticated":

Attempting to connect to ws://10.192.200.5:4000 Connected successfully

Checking config Config is valid

Checking authentication Server is not authenticated with Amazon, beginning login...

Enter your Amazon login details
Email address: xxxxxxxx
Password: xxxxxxxxxxxxx
Server is authenticated

Type 'help' for commands.

> list
ERROR: Not authenticated
> 

@nlenevez I see there the client says the config is valid. Which makes me think you have not purged the servers persisted config files as I said above? It all needs to be scrubbed out, and go from scratch

@nlenevez
Copy link

nlenevez commented Jan 4, 2025

@madmachinations Yes I have scrubbed everything and started fresh. It asked for the base URL the first time but still failed the same way.

@madmachinations
Copy link
Owner

@madmachinations Yes I have scrubbed everything and started fresh. It asked for the base URL the first time but still failed the same way.

Do you have a pass key on your amazon account?

@nlenevez
Copy link

nlenevez commented Jan 4, 2025

@madmachinations no passkey just regular MFA via SMS and e-mail. Each login attempt is triggering the MFA code to be sent but the client never asks for it

@madmachinations
Copy link
Owner

@madmachinations no passkey just regular MFA via SMS and e-mail. Each login attempt is triggering the MFA code to be sent but the client never asks for it

Are you sure you're running the latest server?

@nlenevez
Copy link

nlenevez commented Jan 4, 2025

yes and very latest client. Docker image says it is 2 hours old (2501.004)

@madmachinations
Copy link
Owner

yes and very latest client. Docker image says it is 2 hours old (2501.004)

Hmmmm, I've just looked at amazon.com.au and compared it to the whole flow - nothing looks out of the ordinary to me.

Everything matches up. The buttons, fields, everything are the same as they are for everything else.

Can you tell me about where you are running the server exactly please? On what kind of hardware? What OS?

@nlenevez
Copy link

nlenevez commented Jan 4, 2025

HAOS 14.1 (2025.1.0) on x86 VM. Your plugin installed via HASS (removed old repo, added your new one). I am trying to find any trace of the old version but not having any luck.

@madmachinations
Copy link
Owner

HAOS 14.1 (2025.1.0) on x86 VM. Your plugin installed via HASS (removed old repo, added your new one). I am trying to find any trace of the old version but not having any luck.

How technical are you? Like, how are you with python?

@nlenevez
Copy link

nlenevez commented Jan 4, 2025

@madmachinations I'm fairly technical but not particularly skilled in docker. I've had a poke around, I can see that is has created a new config.json with the baseURL, and there is a cookies.json with what looks to be valid data.

@nlenevez
Copy link

nlenevez commented Jan 5, 2025

OK so I have gotten somewhere. I removed MFA from my Amazon account and tried to login again. No good same issue. Turned MFA back on, now the client is asking for the OTP and it has let me in!

@madmachinations
Copy link
Owner

OK so I have gotten somewhere. I removed MFA from my Amazon account and tried to login again. No good same issue. Turned MFA back on, now the client is asking for the OTP and it has let me in!

Weird, but good to know! I wonder if you had multiple MFA set up on your Amazon account perhaps? Maybe the MFA form looks different in that case or asks some weird question the selenium implementation can't handle.

@madmachinations
Copy link
Owner

Okay I have added notes about multiple MFAs to the new setup guide on the wiki, and I will close this issue as it's kinda vague in subject and a duplicate, and it's assumed to be working currently.

Any other shit that hits the fan is new business.

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

No branches or pull requests

5 participants