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

Alexa authentication bug, url is wrong, Cannot load Integration #1927

Closed
jazzmonger opened this issue May 5, 2023 · 17 comments
Closed

Alexa authentication bug, url is wrong, Cannot load Integration #1927

jazzmonger opened this issue May 5, 2023 · 17 comments

Comments

@jazzmonger
Copy link

jazzmonger commented May 5, 2023

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug
Unlike others, I'll provide as much info as I possibly can. If you need something else, pls be very specific on how to get it for you.

The problem lies in the automated url generation for authorization
...ui.nabu.casa:0/auth/alexamedia...
The :0 shouldn't be there. If you remove it, you get a lot further, but it still won't authenticate

To Reproduce

just try and add the Alexa Media Player

Expected behavior
Add the integration

Authorize with a VALID url.
Screenshots

961B2E10-4F02-4F9A-B6CB-290C24833FAE

System details

  • Home-assistant (version): 2023.5.0

  • alexa_media (version from const.py or HA startup): From HACS 4.6.2

  • alexapy (version from pip show alexapy or HA startup): There is no way to tell. Integration isn't available on startup.

  • Amazon 2FA is enabled (y/n)yes

:

Logs no way to provide logs if you can't even load the integration.
Please provide logs.

Additional context

@zeldoy24

This comment was marked as off-topic.

@jazzmonger

This comment was marked as off-topic.

@zeldoy24

This comment was marked as off-topic.

@jazzmonger jazzmonger changed the title Alexa authentication bug, url is wrong Alexa authentication bug, url is wrong, Cannot load Integration May 5, 2023
@jazzmonger
Copy link
Author

jazzmonger commented May 6, 2023

Revert using home assistant restore or load older version of Alexa Media Player?

live tried older versions of the Media Player back to 4.6.0 and all do the same thing, so this looks like a home assistant core issue...

@zeldoy24
Copy link

zeldoy24 commented May 6, 2023

@jazzmonger older home assistant file..like 4.6 and older backups integrated it again

@zeldoy24

This comment was marked as off-topic.

@surya2302-droid
Copy link

facing the same error. downgrading HA core to 2023.4.1 seems to resolve the error as of now

@zeldoy24

This comment was marked as off-topic.

@alandtse
Copy link
Owner

alandtse commented May 6, 2023

This is not a discussion forum. Please do not pollute it with off topic conversations. This makes it difficult for those who may want to read it to get to the information they may need. It also spams peoples emails with unnecessary info.

The port number is pulled from HA. We don't populate it. Please check your Settings -> Network:
image

We have heard reports disabling for setup IPv6 can workaround networking errors with the auth proxy.

I can't do anything without enabling debug logs. You can obfuscate your HA url, but please leave the port intact. There's debug lines when it sets up the callback url.

@alandtse
Copy link
Owner

alandtse commented May 6, 2023

As a note, when configuring the component, it lets you check the url that it found. What is it saying there?
image

@iamehkri
Copy link

iamehkri commented May 7, 2023

This is not a discussion forum. Please do not pollute it with off topic conversations. This makes it difficult for those who may want to read it to get to the information they may need. It also spams peoples emails with unnecessary info.

The port number is pulled from HA. We don't populate it. Please check your Settings -> Network: image

We have heard reports disabling for setup IPv6 can workaround networking errors with the auth proxy.

I can't do anything without enabling debug logs. You can obfuscate your HA url, but please leave the port intact. There's debug lines when it sets up the callback url.

I changed my network to disable IPV6

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 130, in _call_sslobject_method
result = func(*args)
File "/usr/local/lib/python3.10/ssl.py", line 917, in read
v = self._sslobj.read(len)
ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:2578)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 34, in read
return await self._stream.receive(max_bytes=max_bytes)
File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 195, in receive
data = await self._call_sslobject_method(self._ssl_object.read, max_bytes)
File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 137, in _call_sslobject_method
data = await self.transport_stream.receive()
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1265, in receive
await self._protocol.read_event.wait()
File "/usr/local/lib/python3.10/asyncio/locks.py", line 214, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 32, in read
with anyio.fail_after(timeout):
File "/usr/local/lib/python3.10/site-packages/anyio/_core/_tasks.py", line 118, in exit
raise TimeoutError
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
raise exc
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
response = await connection.handle_async_request(request)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 90, in handle_async_request
return await self._connection.handle_async_request(request)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 116, in handle_async_request
raise exc
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 95, in handle_async_request
) = await self._receive_response_headers(**kwargs)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 159, in _receive_response_headers
event = await self._receive_event(timeout=timeout)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 195, in _receive_event
data = await self._network_stream.read(
File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 31, in read
with map_exceptions(exc_map):
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc)
httpcore.ReadTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
result = await result
File "/config/custom_components/alexa_media/config_flow.py", line 886, in wrapped
return await cls.handler(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/auth_capture_proxy.py", line 387, in all_handler
resp = await getattr(self.session, method)(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1754, in get
return await self.request(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 352, in handle_async_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout

@iamehkri
Copy link

iamehkri commented May 7, 2023

And the URL in the windows to "Access Home Assistant" matched my URL that I have for online access.

@jazzmonger
Copy link
Author

jazzmonger commented May 7, 2023

you CANNOT enable deg logs if the integration isn't loaded. Cloud access works just fine. And no matter what I change, there is always a :0 in the URL that is opened when trying to add the Alexa Media Payer integration.

BC0BBEB7-49D6-44A2-892E-F53A82BC48DB
903F55B3-673D-41B6-B04D-1D50E72A9BDD

F98A5BAB-E95A-4119-8386-9C560B127987

This behavior was introduced in the latest core update. If we downgrade, it works.
There are MANY folks experiencing exactly the same thing.

again, tell me specifically what else you need and I'm happy to provide gory details. I'm not a newbie. If it wasn't clear, I'm using a Debian Supervised install- a literally plain vanilla supported install on a purpose built, dedicated NUC.

@jazzmonger
Copy link
Author

jazzmonger commented May 7, 2023

Ok, more info. If I change the home assistant URL to local, the web browser opens and I authenticate. BUT, nothing happens in the home assistant app. The open browser pop up remains and the integration is NOT loaded.

B0B576CC-9A14-47CB-9C93-82AE69C34363

847F7FD8-8C84-4D37-8B0F-29DCF56CA299

@jazzmonger
Copy link
Author

jazzmonger commented May 7, 2023

SUCCESS. If I use a web browser (NOT the IOS ha app), AND I change the ha access URL to local from the default Nabucasa url, I'm able to authenticate and add the integration.

59836D6C-D4B2-41A0-85DA-B7F6ADA73046

again, I'm happy to test further to help isolate the bug.
2C89FE71-F965-4E38-97F5-D9FC73D0C707

4CA6DFB8-99AD-43C4-B846-34C42097BA5B

@iamehkri
Copy link

iamehkri commented May 7, 2023

The above method has worked for me as well.

@DaveStLou
Copy link

The local IP and port worked for me.

As an additional point of information, I was getting the error not only while using the NabuCasa url but also while using my Cloudflare redirected url. Neither of those use a port to get to my HA from outside my network.

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

No branches or pull requests

6 participants