mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
@ -74,12 +74,12 @@ void MSADeviceCodeStep::perform()
|
||||
m_task->setAskRetry(false);
|
||||
m_task->addNetAction(m_request);
|
||||
|
||||
connect(m_task.get(), &Task::finished, this, &MSADeviceCodeStep::deviceAutorizationFinished);
|
||||
connect(m_task.get(), &Task::finished, this, &MSADeviceCodeStep::deviceAuthorizationFinished);
|
||||
|
||||
m_task->start();
|
||||
}
|
||||
|
||||
struct DeviceAutorizationResponse {
|
||||
struct DeviceAuthorizationResponse {
|
||||
QString device_code;
|
||||
QString user_code;
|
||||
QString verification_uri;
|
||||
@ -90,17 +90,17 @@ struct DeviceAutorizationResponse {
|
||||
QString error_description;
|
||||
};
|
||||
|
||||
DeviceAutorizationResponse parseDeviceAutorizationResponse(const QByteArray& data)
|
||||
DeviceAuthorizationResponse parseDeviceAuthorizationResponse(const QByteArray& data)
|
||||
{
|
||||
QJsonParseError err;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(data, &err);
|
||||
if (err.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Failed to parse device autorization response due to err:" << err.errorString();
|
||||
qWarning() << "Failed to parse device authorization response due to err:" << err.errorString();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!doc.isObject()) {
|
||||
qWarning() << "Device autorization response is not an object";
|
||||
qWarning() << "Device authorization response is not an object";
|
||||
return {};
|
||||
}
|
||||
auto obj = doc.object();
|
||||
@ -111,9 +111,9 @@ DeviceAutorizationResponse parseDeviceAutorizationResponse(const QByteArray& dat
|
||||
};
|
||||
}
|
||||
|
||||
void MSADeviceCodeStep::deviceAutorizationFinished()
|
||||
void MSADeviceCodeStep::deviceAuthorizationFinished()
|
||||
{
|
||||
auto rsp = parseDeviceAutorizationResponse(*m_response);
|
||||
auto rsp = parseDeviceAuthorizationResponse(*m_response);
|
||||
if (!rsp.error.isEmpty() || !rsp.error_description.isEmpty()) {
|
||||
qWarning() << "Device authorization failed:" << rsp.error;
|
||||
emit finished(AccountTaskState::STATE_FAILED_HARD,
|
||||
@ -208,12 +208,12 @@ AuthenticationResponse parseAuthenticationResponse(const QByteArray& data)
|
||||
QJsonParseError err;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(data, &err);
|
||||
if (err.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Failed to parse device autorization response due to err:" << err.errorString();
|
||||
qWarning() << "Failed to parse device authorization response due to err:" << err.errorString();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!doc.isObject()) {
|
||||
qWarning() << "Device autorization response is not an object";
|
||||
qWarning() << "Device authorization response is not an object";
|
||||
return {};
|
||||
}
|
||||
auto obj = doc.object();
|
||||
@ -274,4 +274,4 @@ void MSADeviceCodeStep::authenticationFinished()
|
||||
m_data->msaToken.refresh_token = rsp.refresh_token;
|
||||
m_data->msaToken.token = rsp.access_token;
|
||||
emit finished(AccountTaskState::STATE_WORKING, tr("Got"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user