mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-01-08 19:38:36 +01:00
fix inverted success logic
This commit is contained in:
parent
05671b3da8
commit
728397f3d1
@ -78,7 +78,7 @@ function logoutMojang(id) {
|
|||||||
}),
|
}),
|
||||||
headers: {"content-type": "application/json"},
|
headers: {"content-type": "application/json"},
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
if (isSuccess(data.status)) throw "not success code";
|
if (!isSuccess(data.status)) throw "not success logout";
|
||||||
removeMcAccount(id);
|
removeMcAccount(id);
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
if (confirm("failed to invalidate token! error: " + e + " remove account?")) {
|
if (confirm("failed to invalidate token! error: " + e + " remove account?")) {
|
||||||
|
@ -41,7 +41,7 @@ function refreshTokenMs(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 (isSuccess(xboxResponse.status)) throw "xbox response not success";
|
if (!isSuccess(xboxResponse.status)) throw "xbox response not success";
|
||||||
return xboxResponse.json();
|
return xboxResponse.json();
|
||||||
}).then(json => {
|
}).then(json => {
|
||||||
return fetch(getCorsProxy() + "https://xsts.auth.xboxlive.com/xsts/authorize", {method: "post",
|
return fetch(getCorsProxy() + "https://xsts.auth.xboxlive.com/xsts/authorize", {method: "post",
|
||||||
@ -49,20 +49,20 @@ function refreshTokenMs(username) {
|
|||||||
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 (isSuccess(xstsResponse.status)) throw "xsts response not success";
|
if (!isSuccess(xstsResponse.status)) throw "xsts response not success";
|
||||||
return xstsResponse.json();
|
return xstsResponse.json();
|
||||||
}).then(json => {
|
}).then(json => {
|
||||||
return fetch(getCorsProxy() + "https://api.minecraftservices.com/authentication/login_with_xbox", {method: "post",
|
return fetch(getCorsProxy() + "https://api.minecraftservices.com/authentication/login_with_xbox", {method: "post",
|
||||||
body: JSON.stringify({identityToken: "XBL3.0 x=" + json.DisplayClaims.xui.uhs + ";" + json.Token}),
|
body: JSON.stringify({identityToken: "XBL3.0 x=" + json.DisplayClaims.xui.uhs + ";" + json.Token}),
|
||||||
headers: {"content-type": "application/json"}});
|
headers: {"content-type": "application/json"}});
|
||||||
}).then(mcResponse => {
|
}).then(mcResponse => {
|
||||||
if (isSuccess(mcResponse.status)) throw "mc response not success";
|
if (!isSuccess(mcResponse.status)) throw "mc response not success";
|
||||||
return mcResponse.json();
|
return mcResponse.json();
|
||||||
}).then(json => {
|
}).then(json => {
|
||||||
fetch(getCorsProxy() + "https://api.minecraftservices.com/minecraft/profile", {
|
fetch(getCorsProxy() + "https://api.minecraftservices.com/minecraft/profile", {
|
||||||
method: "get", headers: {"content-type": "application/json", "authorization": "Bearer " + json.access_token}}).then(profile => {
|
method: "get", headers: {"content-type": "application/json", "authorization": "Bearer " + json.access_token}}).then(profile => {
|
||||||
if (profile.status == 404) throw "no profile";
|
if (profile.status == 404) throw "no profile";
|
||||||
if (isSuccess(profile.status)) throw "profile response not success";
|
if (!isSuccess(profile.status)) throw "profile response not success";
|
||||||
return profile.json();
|
return profile.json();
|
||||||
}).then(jsonProfile => {
|
}).then(jsonProfile => {
|
||||||
removeMcAccount(jsonProfile.id);
|
removeMcAccount(jsonProfile.id);
|
||||||
|
Loading…
Reference in New Issue
Block a user