mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-02-15 01:31:24 +01:00
fix http 200 check
This commit is contained in:
parent
7cc2d19605
commit
4d061a7efe
@ -38,20 +38,21 @@ function getMcToken(username) {
|
|||||||
"RpsTicket": "d=" + response.accessToken}, "RelyingParty": "http://auth.xboxlive.com", "TokenType": "JWT"}),
|
"RpsTicket": "d=" + response.accessToken}, "RelyingParty": "http://auth.xboxlive.com", "TokenType": "JWT"}),
|
||||||
headers: {"content-type": "application/json"}});
|
headers: {"content-type": "application/json"}});
|
||||||
}).then(xboxResponse => {
|
}).then(xboxResponse => {
|
||||||
if (xboxResponse != 200) throw "xbox response not 200: " + xboxResponse;
|
if (xboxResponse.status != 200) throw "xbox response not 200";
|
||||||
// We need CORS proxy
|
// We need CORS proxy
|
||||||
return fetch(getCorsProxy() + "https://xsts.auth.xboxlive.com/xsts/authorize", {method: "post",
|
return fetch(getCorsProxy() + "https://xsts.auth.xboxlive.com/xsts/authorize", {method: "post",
|
||||||
body: JSON.stringify({"Properties": {"SandboxId": "RETAIL", "UserTokens": [xboxResponse.json().Token]},
|
body: JSON.stringify({"Properties": {"SandboxId": "RETAIL", "UserTokens": [xboxResponse.json().Token]},
|
||||||
"RelyingParty": "rp://api.minecraftservices.com/", "TokenType": "JWT"}),
|
"RelyingParty": "rp://api.minecraftservices.com/", "TokenType": "JWT"}),
|
||||||
headers: {"content-type": "application/json"}});
|
headers: {"content-type": "application/json"}});
|
||||||
}).then(xstsResponse => {
|
}).then(xstsResponse => {
|
||||||
|
if (xstsResponse.status != 200) throw "xsts response not 200";
|
||||||
// Need CORS proxy here too
|
// Need CORS proxy here too
|
||||||
return fetch(getCorsProxy() + "https://api.minecraftservices.com/authentication/login_with_xbox", {
|
return fetch(getCorsProxy() + "https://api.minecraftservices.com/authentication/login_with_xbox", {
|
||||||
body: JSON.stringify({"identityToken": "XBL3.0 x=" + xstsResponse.json().DisplayClaims.xui.uhs + ";"
|
body: JSON.stringify({"identityToken": "XBL3.0 x=" + xstsResponse.json().DisplayClaims.xui.uhs + ";"
|
||||||
+ xstsResponse.json().Token}), headers: {"content-type": "application/json"}});
|
+ xstsResponse.json().Token}), headers: {"content-type": "application/json"}});
|
||||||
}).then(mcResponse => {
|
}).then(mcResponse => {
|
||||||
console.log(mcResponse); // finally!!!.. todo
|
if (mcResponse.status != 200) throw "mc response not 200";
|
||||||
return mcResponse;
|
return mcResponse.json();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user