Skip to content

Commit e8d6e2c

Browse files
authored
Included Authorization URL from China
When china region (code 86) is selected, WeBack app uses another URL to authentication
1 parent e3d8081 commit e8d6e2c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

custom_components/weback_vacuum/webackapi.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
# API
3333
AUTH_URL = "https://user.grit-cloud.com/prod/oauth"
34+
AUTH_URL_CHINA = "https://user.grit-cloud.cn/prod/oauth"
3435
ROBOT_UPDATE = "thing_status_update"
3536
MAP_DATA = "map_data"
3637
N_RETRY = 8
@@ -95,7 +96,13 @@ async def login(self) -> bool:
9596
if self.verify_cached_creds():
9697
return True
9798

98-
resp = await self.send_http(AUTH_URL, **params)
99+
# Checking if the region is China to use the Chinese Auth URL
100+
if self.region == "86":
101+
auth_url_selected = AUTH_URL_CHINA
102+
else:
103+
auth_url_selected = AUTH_URL
104+
105+
resp = await self.send_http(auth_url_selected, **params)
99106

100107
if resp is None:
101108
_LOGGER.error(

0 commit comments

Comments
 (0)