fix(tidal): auth refresh time diff (#2653)
authorJozef Kruszynski <60214390+jozefKruszynski@users.noreply.github.com>
Fri, 21 Nov 2025 14:12:30 +0000 (15:12 +0100)
committerGitHub <noreply@github.com>
Fri, 21 Nov 2025 14:12:30 +0000 (15:12 +0100)
* 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

index 6ada0f96e7c27ebcfa11f37dcc81628fbba601df..8eea920195353a09db6d446deaa15d59943f93be 100644 (file)
@@ -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