From 6de1e8b2b1633f084d4f362cc5cc9c40460822cb Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 6 Jul 2024 04:18:10 +0100 Subject: [PATCH] fix access token refreshing?!??! --- src/main/java/cc/fascinated/bat/service/SpotifyService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/service/SpotifyService.java b/src/main/java/cc/fascinated/bat/service/SpotifyService.java index e631b65..8826111 100644 --- a/src/main/java/cc/fascinated/bat/service/SpotifyService.java +++ b/src/main/java/cc/fascinated/bat/service/SpotifyService.java @@ -188,7 +188,8 @@ public class SpotifyService { */ @SneakyThrows public void ensureValidToken(SpotifyProfile profile, BatUser user) { - if (profile.getExpiresAt() == null || profile.getExpiresAt() < System.currentTimeMillis()) { + // If the token is still valid, return + if (profile.getExpiresAt() > System.currentTimeMillis()) { return; } SpotifyApi api = new SpotifyApi.Builder()