aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/Yggdrasil.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-05-08 21:43:06 +0200
committerGitHub <noreply@github.com>2022-05-08 21:43:06 +0200
commit1e34de98aba8bc3fd74443f556506c4779c2f8fd (patch)
tree2d113be4a1b888470e11a5e72576522d85e0b865 /launcher/minecraft/auth/Yggdrasil.cpp
parent7b46f50cf1c5709406298424a404a66c948c7a0c (diff)
parentcab40026f2a1253539d0d8e363f1aea32b054bd1 (diff)
downloadPrismLauncher-1e34de98aba8bc3fd74443f556506c4779c2f8fd.tar.gz
PrismLauncher-1e34de98aba8bc3fd74443f556506c4779c2f8fd.tar.bz2
PrismLauncher-1e34de98aba8bc3fd74443f556506c4779c2f8fd.zip
Merge pull request #534 from DioEgizio/stable
Diffstat (limited to 'launcher/minecraft/auth/Yggdrasil.cpp')
-rw-r--r--launcher/minecraft/auth/Yggdrasil.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/launcher/minecraft/auth/Yggdrasil.cpp b/launcher/minecraft/auth/Yggdrasil.cpp
index 7ac842a6..29978411 100644
--- a/launcher/minecraft/auth/Yggdrasil.cpp
+++ b/launcher/minecraft/auth/Yggdrasil.cpp
@@ -209,6 +209,28 @@ void Yggdrasil::processResponse(QJsonObject responseData) {
m_data->yggdrasilToken.validity = Katabasis::Validity::Certain;
m_data->yggdrasilToken.issueInstant = QDateTime::currentDateTimeUtc();
+ // Get UUID here since we need it for later
+ auto profile = responseData.value("selectedProfile");
+ if (!profile.isObject()) {
+ changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send a selected profile."));
+ return;
+ }
+
+ auto profileObj = profile.toObject();
+ for (auto i = profileObj.constBegin(); i != profileObj.constEnd(); ++i) {
+ if (i.key() == "name" && i.value().isString()) {
+ m_data->minecraftProfile.name = i->toString();
+ }
+ else if (i.key() == "id" && i.value().isString()) {
+ m_data->minecraftProfile.id = i->toString();
+ }
+ }
+
+ if (m_data->minecraftProfile.id.isEmpty()) {
+ changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send a UUID in selected profile."));
+ return;
+ }
+
// We've made it through the minefield of possible errors. Return true to indicate that
// we've succeeded.
qDebug() << "Finished reading authentication response.";