"""Provide oauth implementations for the Tesla Fleet integration.""" from typing import Any from homeassistant.components.application_credentials import ( AuthImplementation, AuthorizationServer, ClientCredential, ) from homeassistant.core import HomeAssistant from .const import AUTHORIZE_URL, SCOPES, TOKEN_URL class TeslaUserImplementation(AuthImplementation): """Tesla Fleet API user Oauth2 implementation.""" def __init__( self, hass: HomeAssistant, auth_domain: str, credential: ClientCredential ) -> None: """Initialize user Oauth2 implementation.""" super().__init__( hass, auth_domain, credential, AuthorizationServer(AUTHORIZE_URL, TOKEN_URL), ) @property def extra_authorize_data(self) -> dict[str, Any]: """Extra data that needs to be appended to the authorize url.""" return {"prompt": "login", "scope": " ".join(SCOPES)}