Skip to content

Commit

Permalink
Add support for HASS 2024.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBoot committed Feb 8, 2024
1 parent 22cd67d commit ec6a778
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion custom_components/jwt_cookie/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import gc
import jwt
import logging
from inspect import isawaitable
from http import HTTPStatus
from os import path
from typing import Union
Expand Down Expand Up @@ -248,9 +249,13 @@ async def _async_handle_refresh_token(
response = await super()._async_handle_refresh_token(hass, data, remote_addr)

if response.status == 200:
token = await hass.auth.async_get_refresh_token_by_token(
token = hass.auth.async_get_refresh_token_by_token(
data.get("refresh_token")
)

if isawaitable(token):
token = await token

create_jwt_cookie(response, token.user, self.config)

return response
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "jwt_cookie",
"hacs": "0.0.2",
"hacs": "0.0.3",
"render_readme": true
}

0 comments on commit ec6a778

Please sign in to comment.