fix tidal auth issue on restart
This commit is contained in:
parent
56222b799a
commit
622e95e4df
1 changed files with 10 additions and 4 deletions
|
|
@ -475,10 +475,16 @@ class TidalClient:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_authenticated(self):
|
def is_authenticated(self):
|
||||||
"""Check if client is authenticated"""
|
"""Check if client is authenticated, refreshing expired tokens if possible"""
|
||||||
# Don't trigger authentication automatically here, just check token status
|
if self.access_token and time.time() < self.token_expires_at:
|
||||||
return (self.access_token is not None and
|
return True
|
||||||
time.time() < self.token_expires_at)
|
|
||||||
|
# Token expired but refresh token available — try silent refresh
|
||||||
|
if self.access_token and self.refresh_token:
|
||||||
|
logger.info("Tidal access token expired — attempting silent refresh...")
|
||||||
|
return self._refresh_access_token()
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def _get_user_id(self):
|
def _get_user_id(self):
|
||||||
"""Get current user's ID from /users/me endpoint"""
|
"""Get current user's ID from /users/me endpoint"""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue