From 4aaf7c5432e6557a455970b4d6a3b7b71e0456c0 Mon Sep 17 00:00:00 2001 From: tizzen33 <53906250+tizzen33@users.noreply.github.com> Date: Mon, 13 Jul 2020 22:59:27 +0200 Subject: [PATCH] Convert Toon expires_in value to float (#37716) Co-authored-by: Franck Nijhof --- homeassistant/components/toon/oauth2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/toon/oauth2.py b/homeassistant/components/toon/oauth2.py index fcd4659cea8..feeb44b656a 100644 --- a/homeassistant/components/toon/oauth2.py +++ b/homeassistant/components/toon/oauth2.py @@ -132,4 +132,8 @@ class ToonLocalOAuth2Implementation(config_entry_oauth2_flow.LocalOAuth2Implemen resp = await session.post(self.token_url, data=data, headers=headers) resp.raise_for_status() - return cast(dict, await resp.json()) + resp_json = cast(dict, await resp.json()) + # The Toon API returns "expires_in" as a string for some tenants. + # This is not according to OAuth specifications. + resp_json["expires_in"] = float(resp_json["expires_in"]) + return resp_json