feat: improve miot cloud logic

This commit is contained in:
topsworld 2025-01-10 17:03:19 +08:00
parent 30b42276d5
commit 417514a22f

View File

@ -47,6 +47,7 @@ MIoT http client.
"""
import asyncio
import base64
import hashlib
import json
import logging
import re
@ -136,7 +137,9 @@ class MIoTOauthClient:
'redirect_uri': redirect_url or self._redirect_url,
'client_id': self._client_id,
'response_type': 'code',
'device_id': self._device_id
'device_id': self._device_id,
'state': hashlib.sha1(
f'd={self._device_id}'.encode('utf-8')).hexdigest()
}
if state:
params['state'] = state