17 Invalid refresh token #20

Merged
B00tLoad merged 5 commits from 17-invalid-refresh-token into master 2023-01-28 22:03:18 +01:00
Showing only changes of commit 383990d002 - Show all commits

View File

@@ -84,7 +84,8 @@ public class LastFMToSpotify {
logLn("Cached credentials have been found.", 2);
logLn("Fetching old credentials, refreshing them and saving to cache", 2);
AuthorizationCodeCredentials oldcred = TokenHelper.fetchTokens();
AuthorizationCodeCredentials newcred = api.authorizationCodeRefresh(api.getClientId(), api.getClientSecret(), oldcred.getRefreshToken()).setHeader("User-Agent", configuration.get("requests.useragent")).build().execute();
api.setRefreshToken(oldcred.getRefreshToken());
AuthorizationCodeCredentials newcred = api.authorizationCodeRefresh().build().execute();
TokenHelper.saveTokens(newcred);
configuration.put("spotify.access", newcred.getAccessToken());
} else {