modified: app.py
This commit is contained in:
5
app.py
5
app.py
@@ -14,7 +14,6 @@ import unicodedata
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.secret_key = os.getenv("SECRET_KEY")
|
app.secret_key = os.getenv("SECRET_KEY")
|
||||||
app.config['SESSION_PERMANENT'] = False
|
|
||||||
|
|
||||||
# Erweiterte Berechtigungen für Web Playback SDK
|
# Erweiterte Berechtigungen für Web Playback SDK
|
||||||
SCOPE = "user-library-read playlist-read-private streaming user-read-email user-read-private"
|
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():
|
def get_spotify_client():
|
||||||
token_info = session.get("token_info", None)
|
token_info = session.get("token_info", None)
|
||||||
if not token_info:
|
if not token_info:
|
||||||
# Kein Token, redirect handled elsewhere
|
|
||||||
return None
|
return None
|
||||||
# Prüfen, ob Token abgelaufen ist
|
|
||||||
sp_oauth = SpotifyOAuth(
|
sp_oauth = SpotifyOAuth(
|
||||||
client_id=os.getenv("SPOTIPY_CLIENT_ID"),
|
client_id=os.getenv("SPOTIPY_CLIENT_ID"),
|
||||||
client_secret=os.getenv("SPOTIPY_CLIENT_SECRET"),
|
client_secret=os.getenv("SPOTIPY_CLIENT_SECRET"),
|
||||||
redirect_uri=os.getenv("SPOTIPY_REDIRECT_URI"),
|
redirect_uri=os.getenv("SPOTIPY_REDIRECT_URI"),
|
||||||
scope=SCOPE,
|
scope=SCOPE,
|
||||||
cache_path=".cache"
|
cache_path=None # <--- wichtig!
|
||||||
)
|
)
|
||||||
if sp_oauth.is_token_expired(token_info):
|
if sp_oauth.is_token_expired(token_info):
|
||||||
token_info = sp_oauth.refresh_access_token(token_info['refresh_token'])
|
token_info = sp_oauth.refresh_access_token(token_info['refresh_token'])
|
||||||
|
|||||||
Reference in New Issue
Block a user