core/homeassistant/components/myuplink/application_credentials.py

24 lines
878 B
Python

"""application_credentials platform the myUplink integration."""
from homeassistant.components.application_credentials import AuthorizationServer
from homeassistant.core import HomeAssistant
from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN
async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer:
"""Return authorization server."""
return AuthorizationServer(
authorize_url=OAUTH2_AUTHORIZE,
token_url=OAUTH2_TOKEN,
)
async def async_get_description_placeholders(hass: HomeAssistant) -> dict[str, str]:
"""Return description placeholders for the credentials dialog."""
return {
"more_info_url": f"https://www.home-assistant.io/integrations/{DOMAIN}/",
"create_creds_url": "https://dev.myuplink.com/apps",
"callback_url": "https://my.home-assistant.io/redirect/oauth",
}