Files
core/homeassistant/components/teslemetry/application_credentials.py
2025-12-29 16:40:45 +01:00

31 lines
925 B
Python

"""Application Credentials platform the Teslemetry integration."""
from homeassistant.components.application_credentials import (
AuthorizationServer,
ClientCredential,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow
from .const import AUTHORIZE_URL, TOKEN_URL
from .oauth import TeslemetryImplementation
async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer:
"""Return authorization server."""
return AuthorizationServer(
authorize_url=AUTHORIZE_URL,
token_url=TOKEN_URL,
)
async def async_get_auth_implementation(
hass: HomeAssistant, auth_domain: str, credential: ClientCredential
) -> config_entry_oauth2_flow.AbstractOAuth2Implementation:
"""Return auth implementation."""
return TeslemetryImplementation(
hass,
auth_domain,
credential.client_id,
)