Convert Toon expires_in value to float (#37716)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
tizzen33 2020-07-13 22:59:27 +02:00 committed by GitHub
parent cd3e045e06
commit 4aaf7c5432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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