Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A simple workaround for multi-profile authlib-injector servers #33

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions launcher/minecraft/auth/Yggdrasil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,21 @@ void Yggdrasil::processResponse(QJsonObject responseData)
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
auto profile = responseData.value("selectedProfile");
if (!profile.isObject()) {
changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send a selected profile."));
return;
auto profiles = responseData.value("availableProfiles");
if (!profiles.isArray()) {
changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send available profiles."));
return;
} else {
if (profiles.toArray().isEmpty()) {
changeState(AccountTaskState::STATE_FAILED_HARD, tr("Account has no available profile."));
return;
} else {
profile = profiles.toArray().first();
}
}
}

auto profileObj = profile.toObject();
Expand Down
Loading