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

Method onRequestDone

launcher/minecraft/auth/steps/XboxUserStep.cpp:47–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void XboxUserStep::onRequestDone(
48 QNetworkReply::NetworkError error,
49 QByteArray data,
50 QList<QNetworkReply::RawHeaderPair> headers
51) {
52 auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
53 requestor->deleteLater();
54
55 if (error != QNetworkReply::NoError) {
56 qWarning() << "Reply error:" << error;
57 if (Net::isApplicationError(error)) {
58 emit finished(AccountTaskState::STATE_FAILED_SOFT,
59 tr("XBox user authentication failed: %1").arg(requestor->errorString_)
60 );
61 }
62 else {
63 emit finished(
64 AccountTaskState::STATE_OFFLINE,
65 tr("XBox user authentication failed: %1").arg(requestor->errorString_)
66 );
67 }
68 return;
69 }
70
71 Katabasis::Token temp;
72 if(!Parsers::parseXTokenResponse(data, temp, "UToken")) {
73 qWarning() << "Could not parse user authentication response...";
74 emit finished(AccountTaskState::STATE_FAILED_SOFT, tr("XBox user authentication response could not be understood."));
75 return;
76 }
77 m_data->userToken = temp;
78 emit finished(AccountTaskState::STATE_WORKING, tr("Got Xbox user token"));
79}

Callers

nothing calls this directly

Calls 2

isApplicationErrorFunction · 0.85
parseXTokenResponseFunction · 0.85

Tested by

no test coverage detected