From f8607d7d8f47e5e46401bb17443222f342b910ae Mon Sep 17 00:00:00 2001 From: Jozef Kruszynski <60214390+jozefKruszynski@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:12:30 +0100 Subject: [PATCH] fix(tidal): auth refresh time diff (#2653) * fix(tidal): auth refresh time diff Auth expiration check was using only 60 seconds rather than the intended 60 minutes. Using timedelta to show full intention Closes #4425 * fix(tidal): invert current logic, and use constant for buffer --- music_assistant/providers/tidal/auth_manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/music_assistant/providers/tidal/auth_manager.py b/music_assistant/providers/tidal/auth_manager.py index 6ada0f96..8eea9201 100644 --- a/music_assistant/providers/tidal/auth_manager.py +++ b/music_assistant/providers/tidal/auth_manager.py @@ -24,6 +24,8 @@ TOKEN_TYPE = "Bearer" AUTH_URL = "https://auth.tidal.com/v1/oauth2" REDIRECT_URI = "https://tidal.com/android/login/auth" +TOKEN_REFRESH_BUFFER = 60 * 7 # 7 minutes + @dataclass class TidalUser: @@ -125,7 +127,7 @@ class TidalAuthManager: # Check if token is expired expires_at = self._auth_info.get("expires_at", 0) # type: ignore[unreachable] - if expires_at > time.time() - 60: + if expires_at > time.time() + TOKEN_REFRESH_BUFFER: return True # Need to refresh token -- 2.34.1