feat: implement MSA client id override

Closes #11
This commit is contained in:
Sefa Eyeoglu 2022-02-12 20:20:51 +01:00
parent bb02226870
commit 0854e83ce4
No known key found for this signature in database
GPG Key ID: C10411294912A422
4 changed files with 14 additions and 2 deletions

View File

@ -1519,3 +1519,13 @@ QString Application::getJarsPath()
}
return m_jarsPath;
}
QString Application::getMSAClientID()
{
QString clientIDOverride = m_settings->get("MSAClientIDOverride").toString();
if (!clientIDOverride.isEmpty()) {
return clientIDOverride;
}
return BuildConfig.MSA_CLIENT_ID;
}

View File

@ -117,6 +117,8 @@ public:
QString getJarsPath();
QString getMSAClientID();
/// this is the root of the 'installation'. Used for automatic updates
const QString &root() {
return m_rootPath;

View File

@ -14,7 +14,7 @@ using Activity = Katabasis::Activity;
MSAStep::MSAStep(AccountData* data, Action action) : AuthStep(data), m_action(action) {
OAuth2::Options opts;
opts.scope = "XboxLive.signin offline_access";
opts.clientIdentifier = BuildConfig.MSA_CLIENT_ID;
opts.clientIdentifier = APPLICATION->getMSAClientID();
opts.authorizationUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode";
opts.accessTokenUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";

View File

@ -73,7 +73,7 @@ AccountListPage::AccountListPage(QWidget *parent)
updateButtonStates();
// Xbox authentication won't work without a client identifier, so disable the button if it is missing
ui->actionAddMicrosoft->setVisible(BuildConfig.MSA_CLIENT_ID.size() != 0);
ui->actionAddMicrosoft->setVisible(!APPLICATION->getMSAClientID().isEmpty());
}
AccountListPage::~AccountListPage()