mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
Fix Microsoft authentication (#2986)
* fix: microsoft login #2979 * fix: typo
This commit is contained in:
parent
4104ca082d
commit
9cf23f69a6
@ -43,7 +43,7 @@ public class AuthlibInjectorDownloader implements AuthlibInjectorArtifactProvide
|
||||
private final Supplier<DownloadProvider> downloadProvider;
|
||||
|
||||
/**
|
||||
* @param artifactsDirectory where to save authlib-injector artifacts
|
||||
* @param artifactLocation where to save authlib-injector artifacts
|
||||
*/
|
||||
public AuthlibInjectorDownloader(Path artifactLocation, Supplier<DownloadProvider> downloadProvider) {
|
||||
this.artifactLocation = artifactLocation;
|
||||
|
@ -146,6 +146,16 @@ public class MicrosoftService {
|
||||
|
||||
long notAfter = minecraftResponse.expiresIn * 1000L + System.currentTimeMillis();
|
||||
|
||||
// Check MC ownership, this is necessary, see GitHub#2979
|
||||
HttpURLConnection request = HttpRequest.GET("https://api.minecraftservices.com/entitlements/mcstore")
|
||||
.authorization("Bearer " + minecraftResponse.accessToken)
|
||||
.retry(5)
|
||||
.accept("application/json").createConnection();
|
||||
|
||||
if (request.getResponseCode() != 200) {
|
||||
throw new ResponseCodeException(new URL("https://api.minecraftservices.com/entitlements/mcstore"), request.getResponseCode());
|
||||
}
|
||||
|
||||
// Get Minecraft Account UUID
|
||||
MinecraftProfileResponse profileResponse = getMinecraftProfile(minecraftResponse.tokenType, minecraftResponse.accessToken);
|
||||
handleErrorResponse(profileResponse);
|
||||
|
Loading…
x
Reference in New Issue
Block a user