mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove unneeded token_request override in Geocaching (#72713)
This commit is contained in:
parent
45e4dd379b
commit
7ecb527648
@ -1,7 +1,7 @@
|
|||||||
"""oAuth2 functions and classes for Geocaching API integration."""
|
"""oAuth2 functions and classes for Geocaching API integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, cast
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.application_credentials import (
|
from homeassistant.components.application_credentials import (
|
||||||
AuthImplementation,
|
AuthImplementation,
|
||||||
@ -9,7 +9,6 @@ from homeassistant.components.application_credentials import (
|
|||||||
ClientCredential,
|
ClientCredential,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
|
||||||
|
|
||||||
from .const import ENVIRONMENT, ENVIRONMENT_URLS
|
from .const import ENVIRONMENT, ENVIRONMENT_URLS
|
||||||
|
|
||||||
@ -65,13 +64,3 @@ class GeocachingOAuth2Implementation(AuthImplementation):
|
|||||||
|
|
||||||
new_token = await self._token_request(data)
|
new_token = await self._token_request(data)
|
||||||
return {**token, **new_token}
|
return {**token, **new_token}
|
||||||
|
|
||||||
async def _token_request(self, data: dict) -> dict:
|
|
||||||
"""Make a token request."""
|
|
||||||
data["client_id"] = self.client_id
|
|
||||||
if self.client_secret is not None:
|
|
||||||
data["client_secret"] = self.client_secret
|
|
||||||
session = async_get_clientsession(self.hass)
|
|
||||||
resp = await session.post(ENVIRONMENT_URLS[ENVIRONMENT]["token_url"], data=data)
|
|
||||||
resp.raise_for_status()
|
|
||||||
return cast(dict, await resp.json())
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user