1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-07 14:56:25 +01:00
Files
core/homeassistant/components/tesla_fleet/oauth.py
T

38 lines
1.0 KiB
Python

"""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",
"prompt_missing_scopes": "true",
"scope": " ".join(SCOPES),
}