Bug fix: refresh token even when current is valid

This commit is contained in:
Duy Tran Khanh committed 2021-02-11 10:15:16 +07:00
1 parent ee029956b1
commit 9e57c67b59
1 file changed
+6 -6
@@ -14,12 +14,12 @@ public class RefreshTokenTask {
public void run(String name) throws Throwable {
this.profilePath = MinecraftAccount.load(name);
int responseCode = 400;
responseCode = this.authenticator.validate(profilePath.accessToken).statusCode;
if (responseCode >= 200 && responseCode < 300) {
try {
responseCode = this.authenticator.validate(profilePath.accessToken).statusCode;
} catch(RuntimeException e) {}
if (responseCode == 403) {
RefreshResponse response = this.authenticator.refresh(profilePath.accessToken, UUID.fromString(profilePath.clientToken));
// if (response == null) {
// throw new NullPointerException("Response is null?");
// }
if (response == null) {
// Refresh when offline?
return;
@@ -31,8 +31,8 @@ public class RefreshTokenTask {
profilePath.accessToken = response.accessToken;
profilePath.username = response.selectedProfile.name;
profilePath.profileId = response.selectedProfile.id;
profilePath.save();
}
profilePath.save();
}
}