V2020.2.3 Tesla Connection Failure "Unknown Error"

I’ve been having a problem with the Tesla integration for the past few builds and it seemed that 2020.2.3 was supposed to address this by adding oauth3 but instead of saying cannot connect it now just fails outright fails with unknown error. Is anyone else still having issues with the Tesla integration?

Log Details (ERROR)
Logger: aiohttp.server
Source: components/tesla/config_flow.py:157
First occurred: 7:06:51 AM (2 occurrences)
Last logged: 7:10:50 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 172, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 155, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/tesla/config_flow.py", line 57, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/usr/src/homeassistant/homeassistant/components/tesla/config_flow.py", line 157, in validate_input
    (config[CONF_TOKEN], config[CONF_ACCESS_TOKEN]) = await controller.connect(
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 268, in connect
    cars = await self.get_vehicles()
  File "/usr/local/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 357, in get_vehicles
    return (await self.__connection.get("vehicles"))["response"]
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 78, in get
    return await self.post(command, "get", None)
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 96, in post
    self.code = await self.get_authorization_code(
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 372, in get_authorization_code
    code_url = URL(resp.history[-1].url)
IndexError: tuple index out of range

I have the exact same error as well.

Same issue

Same here!

v2021.3.3 Has the same issue. I guess Tesla may no longer be supported…

After playing around a bit I found it that it works fine without 2FA, which is not ideal.

There is a teslajsonpy issue open tracking this too.