From 6970cebf80d25d1dde297a443909c6a22d06a281 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 29 Apr 2019 11:43:13 +0200 Subject: [PATCH] Force auto API password (#1065) --- hassio/api/homeassistant.py | 1 + hassio/homeassistant.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hassio/api/homeassistant.py b/hassio/api/homeassistant.py index 281d0cda2..639bf76c1 100644 --- a/hassio/api/homeassistant.py +++ b/hassio/api/homeassistant.py @@ -106,6 +106,7 @@ class APIHomeAssistant(CoreSysAttributes): if ATTR_REFRESH_TOKEN in body: self.sys_homeassistant.refresh_token = body[ATTR_REFRESH_TOKEN] + self.sys_homeassistant.api_password = None self.sys_homeassistant.save_data() diff --git a/hassio/homeassistant.py b/hassio/homeassistant.py index 151abe441..a3a58b254 100644 --- a/hassio/homeassistant.py +++ b/hassio/homeassistant.py @@ -463,7 +463,7 @@ class HomeAssistant(JsonConfig, CoreSysAttributes): headers[hdrs.CONTENT_TYPE] = content_type # Set old API Password - if self.api_password: + if not self.refresh_token and self.api_password: headers[HEADER_HA_ACCESS] = self.api_password for _ in (1, 2):