实现 #3095 微软登录界面对 XBox 400 错误给予提示 (#3194)

This commit is contained in:
Burning_TNT
2024-07-22 23:06:20 +08:00
committed by GitHub
parent ad5b74d8c7
commit 74abecaae7

View File

@@ -112,21 +112,23 @@ public class MicrosoftService {
}
private MicrosoftSession authenticateViaLiveAccessToken(String liveAccessToken, String liveRefreshToken) throws IOException, JsonParseException, AuthenticationException {
// Authenticate with XBox Live
XBoxLiveAuthenticationResponse xboxResponse = HttpRequest
.POST("https://user.auth.xboxlive.com/user/authenticate")
.json(mapOf(
pair("Properties",
mapOf(pair("AuthMethod", "RPS"), pair("SiteName", "user.auth.xboxlive.com"),
pair("RpsTicket", "d=" + liveAccessToken))),
pair("RelyingParty", "http://auth.xboxlive.com"), pair("TokenType", "JWT")))
.retry(5)
.accept("application/json").getJson(XBoxLiveAuthenticationResponse.class);
String uhs = getUhs(xboxResponse, null);
XBoxLiveAuthenticationResponse minecraftXstsResponse;
String uhs;
XBoxLiveAuthenticationResponse xboxResponse, minecraftXstsResponse;
try {
// Authenticate with XBox Live
xboxResponse = HttpRequest
.POST("https://user.auth.xboxlive.com/user/authenticate")
.json(mapOf(
pair("Properties",
mapOf(pair("AuthMethod", "RPS"), pair("SiteName", "user.auth.xboxlive.com"),
pair("RpsTicket", "d=" + liveAccessToken))),
pair("RelyingParty", "http://auth.xboxlive.com"), pair("TokenType", "JWT")))
.retry(5)
.accept("application/json")
.getJson(XBoxLiveAuthenticationResponse.class);
uhs = getUhs(xboxResponse, null);
minecraftXstsResponse = HttpRequest
.POST("https://xsts.auth.xboxlive.com/xsts/authorize")
.json(mapOf(