Fix MSA login
This commit is contained in:
parent
d40b6d8eb3
commit
7f52d57454
@ -59,9 +59,10 @@ void MSADeviceCodeStep::perform()
|
||||
{
|
||||
QUrlQuery data;
|
||||
data.addQueryItem("client_id", m_clientId);
|
||||
data.addQueryItem("scope", "XboxLive.SignIn XboxLive.offline_access");
|
||||
data.addQueryItem("scope", "service::user.auth.xboxlive.com::MBI_SSL");
|
||||
data.addQueryItem("response_type", "device_code");
|
||||
auto payload = data.query(QUrl::FullyEncoded).toUtf8();
|
||||
QUrl url("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode");
|
||||
QUrl url("https://login.live.com/oauth20_connect.srf");
|
||||
auto headers = QList<Net::HeaderPair>{
|
||||
{ "Content-Type", "application/x-www-form-urlencoded" },
|
||||
{ "Accept", "application/json" },
|
||||
@ -175,8 +176,9 @@ void MSADeviceCodeStep::authenticateUser()
|
||||
data.addQueryItem("client_id", m_clientId);
|
||||
data.addQueryItem("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
||||
data.addQueryItem("device_code", m_device_code);
|
||||
data.addQueryItem("response_type", "device_code");
|
||||
auto payload = data.query(QUrl::FullyEncoded).toUtf8();
|
||||
QUrl url("https://login.microsoftonline.com/consumers/oauth2/v2.0/token");
|
||||
QUrl url("https://login.live.com/oauth20_token.srf");
|
||||
auto headers = QList<Net::HeaderPair>{
|
||||
{ "Content-Type", "application/x-www-form-urlencoded" },
|
||||
{ "Accept", "application/json" },
|
||||
|
@ -104,9 +104,16 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile
|
||||
} else {
|
||||
oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this));
|
||||
}
|
||||
oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"));
|
||||
oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token"));
|
||||
oauth2.setScope("XboxLive.SignIn XboxLive.offline_access");
|
||||
oauth2.setAuthorizationUrl(QUrl("https://login.live.com/oauth20_connect.srf"));
|
||||
oauth2.setAccessTokenUrl(QUrl("https://login.live.com/oauth20_token.srf"));
|
||||
const auto& scope = "service::user.auth.xboxlive.com::MBI_SSL";
|
||||
oauth2.setScope(scope);
|
||||
// QOAuth2AuthorizationCodeFlow doesn't pass a "scope" when refreshing access tokens, but Microsoft expects it.
|
||||
oauth2.setModifyParametersFunction([](QAbstractOAuth::Stage stage, QMultiMap<QString, QVariant>* parameters) {
|
||||
if (stage == QAbstractOAuth::Stage::RefreshingAccessToken) {
|
||||
(*parameters).insert("scope", scope);
|
||||
}
|
||||
});
|
||||
oauth2.setClientIdentifier(m_clientId);
|
||||
oauth2.setNetworkAccessManager(APPLICATION->network().get());
|
||||
|
||||
|
@ -145,11 +145,7 @@ void MSALoginDialog::authorizeWithBrowserWithExtra(QString url, QString code, in
|
||||
ui->code->setText(code);
|
||||
auto isDefaultUrl = url == "https://www.microsoft.com/link";
|
||||
ui->qr->setVisible(isDefaultUrl);
|
||||
if (isDefaultUrl) {
|
||||
ui->qrMessage->setText(tr("Open %1 or scan the QR and enter the above code.").arg(linkString));
|
||||
} else {
|
||||
ui->qrMessage->setText(tr("Open %1 and enter the above code.").arg(linkString));
|
||||
}
|
||||
}
|
||||
|
||||
void MSALoginDialog::onDeviceFlowStatus(QString status)
|
||||
|
@ -22,6 +22,9 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget2">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@ -140,51 +143,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="orLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Or</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
|
Loading…
Reference in New Issue
Block a user