From 635851807a660d401f60990520906d426e3bb6bc Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:41:23 +1200 Subject: [PATCH] Fix HA addon auth using HA credentials (#3758) --- esphome/dashboard/dashboard.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/dashboard/dashboard.py b/esphome/dashboard/dashboard.py index e7a17cba4c..889f5cc0bf 100644 --- a/esphome/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -816,15 +816,16 @@ class LoginHandler(BaseHandler): import requests headers = { - "Authentication": f"Bearer {os.getenv('SUPERVISOR_TOKEN')}", + "X-Supervisor-Token": os.getenv("SUPERVISOR_TOKEN"), } + data = { "username": self.get_argument("username", ""), "password": self.get_argument("password", ""), } try: req = requests.post( - "http://supervisor/auth", headers=headers, data=data, timeout=30 + "http://supervisor/auth", headers=headers, json=data, timeout=30 ) if req.status_code == 200: self.set_secure_cookie("authenticated", cookie_authenticated_yes)