aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/Yggdrasil.cpp
diff options
context:
space:
mode:
authorTheCodex6824 <thecodex6824@gmail.com>2022-04-21 16:01:55 -0400
committerTheCodex6824 <thecodex6824@gmail.com>2022-04-22 23:39:38 -0400
commit8bcbe07c87ee4b776d9ba743bb598f22ee80dda0 (patch)
tree9f25883df7d42d8ec2db8d569b8ae27619e5da5d /launcher/minecraft/auth/Yggdrasil.cpp
parent5adcc26190b82dc9c1050452645d762f5e8b5a5e (diff)
downloadPrismLauncher-8bcbe07c87ee4b776d9ba743bb598f22ee80dda0.tar.gz
PrismLauncher-8bcbe07c87ee4b776d9ba743bb598f22ee80dda0.tar.bz2
PrismLauncher-8bcbe07c87ee4b776d9ba743bb598f22ee80dda0.zip
Fix Mojang auth failing due to Mojang rejecting requests to the profile endpoint
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.";