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
This commit is contained in:
Evan Goode 2025-01-12 22:54:25 -05:00
parent 8cd807c2d6
commit a5fcdd03bf

View File

@ -88,14 +88,17 @@ void YggdrasilStep::refresh()
* "requestUser": true/false // request the user structure * "requestUser": true/false // request the user structure
* } * }
*/ */
QJsonObject selectedProfile;
selectedProfile.insert("id", m_data->profileId());
selectedProfile.insert("name", m_data->profileName());
QJsonObject req; QJsonObject req;
req.insert("clientToken", m_data->clientToken()); req.insert("clientToken", m_data->clientToken());
req.insert("accessToken", m_data->accessToken()); 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); req.insert("requestUser", false);
QJsonDocument doc(req); QJsonDocument doc(req);