Skip to content

Commit

Permalink
fix: update *.bff.cariad.digital endpoints for different regions (#293)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
SamKirsch10 and pre-commit-ci[bot] authored Mar 17, 2024
1 parent ebb6b17 commit 43699bf
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions custom_components/audiconnect/audi_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ async def get_stored_vehicle_data(self, vin: str):
}
self._api.use_token(self._bearer_token_json)
data = await self._api.get(
"https://emea.bff.cariad.digital/vehicle/v1/vehicles/{vin}/selectivestatus?jobs={jobs}".format(
vin=vin.upper(), jobs=",".join(JOBS2QUERY)
"https://{region}.bff.cariad.digital/vehicle/v1/vehicles/{vin}/selectivestatus?jobs={jobs}".format(
region="emea" if self._country.upper() != "US" else "na",
vin=vin.upper(),
jobs=",".join(JOBS2QUERY),
)
)
_LOGGER.debug(f"{DOMAIN} - Car Data: {data}")
Expand Down Expand Up @@ -220,7 +222,8 @@ async def get_climater(self, vin: str):
async def get_stored_position(self, vin: str):
self._api.use_token(self._bearer_token_json)
return await self._api.get(
"https://emea.bff.cariad.digital/vehicle/v1/vehicles/{vin}/parkingposition".format(
"https://{region}.bff.cariad.digital/vehicle/v1/vehicles/{vin}/parkingposition".format(
region="emea" if self._country.upper() != "US" else "na",
vin=vin.upper(),
)
)
Expand Down Expand Up @@ -858,7 +861,9 @@ async def login_request(self, user: str, password: str):
self._client_id = marketcfg_json["idkClientIDAndroidLive"]

self._authorizationServerBaseURLLive = (
"https://emea.bff.cariad.digital/login/v1/audi"
"https://{region}.bff.cariad.digital/login/v1/audi".format(
region="emea" if self._country.upper() != "US" else "na"
)
)
if "authorizationServerBaseURLLive" in marketcfg_json:
self._authorizationServerBaseURLLive = marketcfg_json[
Expand All @@ -875,10 +880,14 @@ async def login_request(self, user: str, password: str):
authorization_endpoint = "https://identity.vwgroup.io/oidc/v1/authorize"
if "authorization_endpoint" in openidcfg_json:
authorization_endpoint = openidcfg_json["authorization_endpoint"]
self._tokenEndpoint = "https://emea.bff.cariad.digital/login/v1/idk/token"
self._tokenEndpoint = (
"https://{region}.bff.cariad.digital/login/v1/idk/token".format(
region="emea" if self._country.upper() != "US" else "na"
)
)
if "token_endpoint" in openidcfg_json:
self._tokenEndpoint = openidcfg_json["token_endpoint"]
# revocation_endpoint = "https://emea.bff.cariad.digital/login/v1/idk/revoke"
# revocation_endpoint = "https://{region}.bff.cariad.digital/login/v1/idk/revoke".format(region="emea" if self._country.upper() != "US" else "na")
# if "revocation_endpoint" in openidcfg_json:
# revocation_endpoint = openidcfg_json["revocation_endpoint"]

Expand Down

0 comments on commit 43699bf

Please sign in to comment.