add log for token refresh in spotify

This commit is contained in:
Lee 2024-06-28 03:52:29 +01:00
parent eccd673db8
commit e892dade1c

View File

@ -7,6 +7,8 @@ import lombok.Getter;
import lombok.NonNull;
import lombok.SneakyThrows;
import net.jodah.expiringmap.ExpiringMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import se.michaelthelin.spotify.SpotifyApi;
@ -24,6 +26,7 @@ import java.util.concurrent.TimeUnit;
@Service
@Getter
public class SpotifyService {
private static final Logger log = LoggerFactory.getLogger(SpotifyService.class);
/**
* The access token map.
*/
@ -198,6 +201,7 @@ public class SpotifyService {
api.setAccessToken(credentials.getAccessToken());
api.setRefreshToken(credentials.getRefreshToken());
userService.saveUser(user);
log.info("Refreshed spotify access token for user {}", user.getName());
}
return api;
}