From a5fcdd03bfdf365ca2586dde92c8349d85dc4b13 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Sun, 12 Jan 2025 22:54:25 -0500 Subject: [PATCH 1/2] Only send selectedProfile when selecting a profile Some authentication servers (Blessing Skin) care when selectedProfile is sent on POST /refresh but the clientToken is already bound to a profile. We should only include selectedProfile in POST /refresh during the initial "Add authlib-injector account" process when selecting a profile from multiple availableProfiles. For https://github.com/unmojang/FjordLauncher/issues/50 --- launcher/minecraft/auth/steps/YggdrasilStep.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/launcher/minecraft/auth/steps/YggdrasilStep.cpp b/launcher/minecraft/auth/steps/YggdrasilStep.cpp index eb195e9a0..e2f609743 100644 --- a/launcher/minecraft/auth/steps/YggdrasilStep.cpp +++ b/launcher/minecraft/auth/steps/YggdrasilStep.cpp @@ -88,14 +88,17 @@ void YggdrasilStep::refresh() * "requestUser": true/false // request the user structure * } */ - QJsonObject selectedProfile; - selectedProfile.insert("id", m_data->profileId()); - selectedProfile.insert("name", m_data->profileName()); QJsonObject req; req.insert("clientToken", m_data->clientToken()); req.insert("accessToken", m_data->accessToken()); - req.insert("selectedProfile", selectedProfile); + + if (m_didSelectProfile) { + QJsonObject selectedProfile; + selectedProfile.insert("id", m_data->profileId()); + selectedProfile.insert("name", m_data->profileName()); + req.insert("selectedProfile", selectedProfile); + } req.insert("requestUser", false); QJsonDocument doc(req); From a108c8678e10c53ec940b21ac6e6ee3f29d134a1 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Mon, 13 Jan 2025 11:51:33 -0500 Subject: [PATCH 2/2] Remove irrelevant FIXME comment --- launcher/minecraft/auth/steps/YggdrasilStep.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/launcher/minecraft/auth/steps/YggdrasilStep.cpp b/launcher/minecraft/auth/steps/YggdrasilStep.cpp index e2f609743..768e8abe4 100644 --- a/launcher/minecraft/auth/steps/YggdrasilStep.cpp +++ b/launcher/minecraft/auth/steps/YggdrasilStep.cpp @@ -242,8 +242,7 @@ void YggdrasilStep::processResponse(QJsonObject responseData) m_data->yggdrasilToken.validity = Validity::Certain; m_data->yggdrasilToken.issueInstant = QDateTime::currentDateTimeUtc(); - // Get UUID here since we need it for later - // FIXME: Here is a simple workaround for now,, which uses the first available profile when selectedProfile is not provided + // Select a profile auto profile = responseData.value("selectedProfile"); if (profile.isObject()) { m_didSelectProfile = false;