From fab05e12cd063f29f3c8e04172642c70a7657b1c Mon Sep 17 00:00:00 2001 From: Nick Babenko Date: Tue, 10 Mar 2020 09:04:17 +0000 Subject: [PATCH] Set auth headers globally after Google login --- custom_components/badnest/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/badnest/api.py b/custom_components/badnest/api.py index 35b772c..ff91bbb 100644 --- a/custom_components/badnest/api.py +++ b/custom_components/badnest/api.py @@ -96,6 +96,9 @@ class NestAPI(): r = self._session.post(url=URL_JWT, headers=headers, params=params) self._user_id = r.json()['claims']['subject']['nestId']['id'] self._access_token = r.json()['jwt'] + self._session.headers.update({ + "Authorization": f"Basic {self._access_token}", + }) def _login_dropcam(self): self._session.post( @@ -110,7 +113,6 @@ class NestAPI(): r = self._session.get( f"{CAMERA_WEBAPI_BASE}/api/cameras." + "get_owned_and_member_of_with_properties", - headers={"Authorization": f"Basic {self._access_token}"}, ) for camera in r.json()["items"]: