modified: app.py

This commit is contained in:
SimolZimol
2025-06-04 16:51:53 +02:00
parent 2b37032048
commit 7f357cd4da

5
app.py
View File

@@ -14,7 +14,6 @@ import unicodedata
app = Flask(__name__)
app.secret_key = os.getenv("SECRET_KEY")
app.config['SESSION_PERMANENT'] = False
# Erweiterte Berechtigungen für Web Playback SDK
SCOPE = "user-library-read playlist-read-private streaming user-read-email user-read-private"
@@ -36,15 +35,13 @@ def get_translations():
def get_spotify_client():
token_info = session.get("token_info", None)
if not token_info:
# Kein Token, redirect handled elsewhere
return None
# Prüfen, ob Token abgelaufen ist
sp_oauth = SpotifyOAuth(
client_id=os.getenv("SPOTIPY_CLIENT_ID"),
client_secret=os.getenv("SPOTIPY_CLIENT_SECRET"),
redirect_uri=os.getenv("SPOTIPY_REDIRECT_URI"),
scope=SCOPE,
cache_path=".cache"
cache_path=None # <--- wichtig!
)
if sp_oauth.is_token_expired(token_info):
token_info = sp_oauth.refresh_access_token(token_info['refresh_token'])