Xbox integration - Error setting up entry Home Assistant Cloud for xbox

I have been trying to get the Xbox integration working today.

It was working a month or so ago and then stopped working. I removed it and have been trying to get it installed again today without luck.

I have updated xbox and updated controller, and checked that enable remote features is ticked.

When I add the integration it takes me to nabu casa and says integration successful.

Then I get the integration showing in my panel, but no devices or entities and this error in the log:

Log Details (ERROR)


Logger: homeassistant.config_entries
Source: components/xbox/api.py:31 
First occurred: 13:42:23 (2 occurrences) 
Last logged: 13:45:08

Error setting up entry Home Assistant Cloud for xbox
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 234, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/xbox/__init__.py", line 88, in async_setup_entry
    consoles: SmartglassConsoleList = await client.smartglass.get_console_list()
  File "/usr/local/lib/python3.8/site-packages/xbox/webapi/api/provider/smartglass/__init__.py", line 56, in get_console_list
    resp = await self._fetch_list("devices", params)
  File "/usr/local/lib/python3.8/site-packages/xbox/webapi/api/provider/smartglass/__init__.py", line 369, in _fetch_list
    resp = await self.client.session.get(
  File "/usr/local/lib/python3.8/site-packages/xbox/webapi/api/client.py", line 70, in get
    return await self.request(hdrs.METH_GET, url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/xbox/webapi/api/client.py", line 53, in request
    await self._auth_mgr.refresh_tokens()
  File "/usr/src/homeassistant/homeassistant/components/xbox/api.py", line 31, in refresh_tokens
    await super().refresh_tokens()
  File "/usr/local/lib/python3.8/site-packages/xbox/webapi/authentication/manager.py", line 72, in refresh_tokens
    self.xsts_token = await self.request_xsts_token()
  File "/usr/local/lib/python3.8/site-packages/xbox/webapi/authentication/manager.py", line 147, in request_xsts_token
    resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 941, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://xsts.auth.xboxlive.com/xsts/authorize')

Do you have the Xbox mobile app installed and your console setup there?

i have the app, just logged in to it again as it had obviously updated at some point.

app works fine and loads games on my xbox

ok, so the app back set up, and set up the integration in private browsing so I had to log back in properly and its found it!

random! thanks!