MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / processSTSError

Method processSTSError

launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp:112–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112bool XboxAuthorizationStep::processSTSError(
113 QNetworkReply::NetworkError error,
114 QByteArray data,
115 QList<QNetworkReply::RawHeaderPair> headers
116) {
117 if(error == QNetworkReply::AuthenticationRequiredError) {
118 QJsonParseError jsonError;
119 QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError);
120 if(jsonError.error) {
121 qWarning() << "Cannot parse error XSTS response as JSON: " << jsonError.errorString();
122 emit finished(
123 AccountTaskState::STATE_FAILED_SOFT,
124 tr("Cannot parse %1 authorization error response as JSON: %2").arg(m_authorizationKind, jsonError.errorString())
125 );
126 return true;
127 }
128
129 int64_t errorCode = -1;
130 auto obj = doc.object();
131 if(!Parsers::getNumber(obj.value("XErr"), errorCode)) {
132 emit finished(
133 AccountTaskState::STATE_FAILED_SOFT,
134 tr("XErr element is missing from %1 authorization error response.").arg(m_authorizationKind)
135 );
136 return true;
137 }
138 switch(errorCode) {
139 case 2148916233:{
140 emit finished(
141 AccountTaskState::STATE_FAILED_SOFT,
142 tr("This Microsoft account does not have an XBox Live profile. Buy the game on %1 first.")
143 .arg("<a href=\"https://www.minecraft.net/en-us/store/minecraft-java-edition\">minecraft.net</a>")
144 );
145 return true;
146 }
147 case 2148916235: {
148 // NOTE: this is the Grulovia error
149 emit finished(
150 AccountTaskState::STATE_FAILED_SOFT,
151 tr("XBox Live is not available in your country. You've been blocked.")
152 );
153 return true;
154 }
155 case 2148916238: {
156 emit finished(
157 AccountTaskState::STATE_FAILED_SOFT,
158 tr("This Microsoft account is underaged and is not linked to a family.\n\nPlease set up your account according to %1.")
159 .arg("<a href=\"https://help.minecraft.net/hc/en-us/articles/4403181904525\">help.minecraft.net</a>")
160 );
161 return true;
162 }
163 default: {
164 emit finished(
165 AccountTaskState::STATE_FAILED_SOFT,
166 tr("XSTS authentication ended with unrecognized error(s):\n\n%1").arg(errorCode)
167 );
168 return true;
169 }

Callers

nothing calls this directly

Calls 3

fromJsonFunction · 0.85
getNumberFunction · 0.85
objectMethod · 0.80

Tested by

no test coverage detected