Skip to content

Commit

Permalink
Merge pull request #51 from unmojang/evan-goode/fix-selectedProfile
Browse files Browse the repository at this point in the history
Only send `selectedProfile` when selecting a profile
  • Loading branch information
evan-goode authored Jan 13, 2025
2 parents d2d6320 + a108c86 commit d931e8f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions launcher/minecraft/auth/steps/YggdrasilStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -239,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;
Expand Down

0 comments on commit d931e8f

Please sign in to comment.