{"record":{"id":"9463b136322facb0","repo":"home-assistant/core","slug":"invalid-auth-9463b1","errorCode":"invalid_auth","errorMessage":"invalid_auth","messagePattern":"invalid_auth","errorType":"validation","errorClass":"InputValidationError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/bond/config_flow.py","lineNumber":63,"sourceCode":"\n\nasync def _validate_input(hass: HomeAssistant, data: dict[str, Any]) -> tuple[str, str]:\n    \"\"\"Validate the user input allows us to connect.\"\"\"\n\n    bond = Bond(\n        data[CONF_HOST],\n        data[CONF_ACCESS_TOKEN],\n        session=async_get_clientsession(hass),\n        requestor_uuid=RequestorUUID.HOME_ASSISTANT,\n    )\n    try:\n        hub = BondHub(bond, data[CONF_HOST])\n        await hub.setup(max_devices=1)\n    except ClientConnectionError as error:\n        raise InputValidationError(\"cannot_connect\") from error\n    except ClientResponseError as error:\n        if error.status == HTTPStatus.UNAUTHORIZED:\n            raise InputValidationError(\"invalid_auth\") from error\n        raise InputValidationError(\"unknown\") from error\n    except Exception as error:\n        _LOGGER.exception(\"Unexpected exception\")\n        raise InputValidationError(\"unknown\") from error\n\n    # Return unique ID from the hub to be stored in the config entry.\n    if not hub.bond_id:\n        raise InputValidationError(\"old_firmware\")\n\n    return hub.bond_id, hub.name\n\n\nclass BondConfigFlow(ConfigFlow, domain=DOMAIN):\n    \"\"\"Handle a config flow for Bond.\"\"\"\n\n    VERSION = 1\n\n    def __init__(self) -> None:","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/bond/config_flow.py#L45-L81","documentation":"Raised in the Bond config flow when BondHub.setup() fails with an aiohttp ClientResponseError whose status is HTTP 401 UNAUTHORIZED. The hub answered, but the access token (CONF_ACCESS_TOKEN) was rejected. It is surfaced as InputValidationError('invalid_auth') so the UI prompts for new credentials.","triggerScenarios":"Submitting the config form with a wrong, revoked, or typo'd Bond access token; a token regenerated in the Bond app after it was saved in Home Assistant; token copied with whitespace or missing characters.","commonSituations":"Token reset from the Bond app (Settings > Local API key), copy/paste truncation, using the cloud token instead of the local API token.","solutions":["Open the Bond app, go to hub Settings > Local API Access / Integrations, and copy the current token exactly.","Re-enter host + token in the config flow and resubmit.","If the token was regenerated, regenerate deliberately and update every client using the old one."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async def token_valid(host: str, token: str, session) -> bool:\n    resp = await session.get(\n        f\"http://{host}:30001/v2/devices\",\n        headers={\"BOND-Token\": token},\n    )\n    return resp.status != 401","typeGuard":null,"tryCatchPattern":"try:\n    hub = BondHub(bond); await hub.setup(max_devices=1)\nexcept ClientResponseError as err:\n    if err.status == HTTPStatus.UNAUTHORIZED:\n        # prompt user to re-enter the access token\n        ...","preventionTips":["Copy the token from Bond app > hub Settings > Local Integrations in one action; avoid retyping.","When rotating tokens, update Home Assistant in the same change window.","Test the token with a curl call before saving the config entry."],"tags":["bond","config-flow","authentication","http-401","home-assistant"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}