Skip to content

Commit

Permalink
Merge pull request #30 from dpecharroman/patch-1
Browse files Browse the repository at this point in the history
Included Authorization URL from China
  • Loading branch information
Jezza34000 authored Apr 1, 2024
2 parents e3d8081 + e8d6e2c commit 1aefb52
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/weback_vacuum/webackapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

# API
AUTH_URL = "https://user.grit-cloud.com/prod/oauth"
AUTH_URL_CHINA = "https://user.grit-cloud.cn/prod/oauth"
ROBOT_UPDATE = "thing_status_update"
MAP_DATA = "map_data"
N_RETRY = 8
Expand Down Expand Up @@ -95,7 +96,13 @@ async def login(self) -> bool:
if self.verify_cached_creds():
return True

resp = await self.send_http(AUTH_URL, **params)
# Checking if the region is China to use the Chinese Auth URL
if self.region == "86":
auth_url_selected = AUTH_URL_CHINA
else:
auth_url_selected = AUTH_URL

resp = await self.send_http(auth_url_selected, **params)

if resp is None:
_LOGGER.error(
Expand Down

0 comments on commit 1aefb52

Please sign in to comment.