Send the SmartThings token request credentials as a header

aiohttp deprecates BasicAuth and the per-request auth argument in favour
of encode_basic_auth() plus an Authorization header.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PRmnu5HiXQUaHcHnNCvBSU
This commit is contained in:
Claude
2026-08-22 15:59:29 +00:00
parent f77bc02f87
commit e9c9d96b99
@@ -4,7 +4,7 @@ from json import JSONDecodeError
import logging
from typing import cast, override
from aiohttp import BasicAuth, ClientError
from aiohttp import ClientError, encode_basic_auth
from homeassistant.components.application_credentials import (
AuthImplementation,
@@ -46,7 +46,9 @@ class SmartThingsOAuth2Implementation(AuthImplementation):
resp = await session.post(
self.token_url,
data=data,
auth=BasicAuth(self.client_id, self.client_secret),
headers={
"Authorization": encode_basic_auth(self.client_id, self.client_secret)
},
)
if resp.status >= 400:
try: