Fix scope comparison in SmartThings (#139652)

This commit is contained in:
Joost Lekkerkerker 2025-03-02 19:52:37 +01:00 committed by Franck Nijhof
parent ad04b53615
commit 03cb177e7c
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ class SmartThingsConfigFlow(AbstractOAuth2FlowHandler, domain=DOMAIN):
async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
"""Create an entry for SmartThings."""
if data[CONF_TOKEN]["scope"].split() != SCOPES:
if not set(data[CONF_TOKEN]["scope"].split()) >= set(SCOPES):
return self.async_abort(reason="missing_scopes")
client = SmartThings(session=async_get_clientsession(self.hass))
client.authenticate(data[CONF_TOKEN][CONF_ACCESS_TOKEN])

View File

@ -261,7 +261,7 @@ async def test_reauthentication(
"expires_in": 82806,
"scope": "r:devices:* w:devices:* x:devices:* r:hubs:* "
"r:locations:* w:locations:* x:locations:* "
"r:scenes:* x:scenes:* r:rules:* w:rules:* sse",
"r:scenes:* x:scenes:* r:rules:* sse w:rules:*",
"access_tier": 0,
"installed_app_id": "5aaaa925-2be1-4e40-b257-e4ef59083324",
},
@ -279,7 +279,7 @@ async def test_reauthentication(
"expires_in": 82806,
"scope": "r:devices:* w:devices:* x:devices:* r:hubs:* "
"r:locations:* w:locations:* x:locations:* "
"r:scenes:* x:scenes:* r:rules:* w:rules:* sse",
"r:scenes:* x:scenes:* r:rules:* sse w:rules:*",
"access_tier": 0,
"installed_app_id": "5aaaa925-2be1-4e40-b257-e4ef59083324",
}