When the GET request from askFromUser is scheduled on the QNAM inside
the slot that handles the QNetworkReply::finished signal, it seems to
not get processed at all.
This workaround moves the sending of the new GET to the event loop,
sidestepping the problem.
namespace OCC {
void HttpCredentialsGui::askFromUser()
+{
+ // Unfortunately there's a bug that doesn't allow us to send the "is this
+ // OAuth2 or Basic auth?" GET request directly. Scheduling it for the event
+ // loop works though. See #5989.
+ QMetaObject::invokeMethod(this, "askFromUserAsync", Qt::QueuedConnection);
+}
+
+void HttpCredentialsGui::askFromUserAsync()
{
_password = QString(); // So our QNAM does not add any auth
* This will query the server and either uses OAuth via _asyncAuth->start()
* or call showDialog to ask the password
*/
- Q_INVOKABLE void askFromUser() Q_DECL_OVERRIDE;
+ void askFromUser() Q_DECL_OVERRIDE;
/**
* In case of oauth, return an URL to the link to open the browser.
* An invalid URL otherwise
void authorisationLinkChanged();
private:
+ Q_INVOKABLE void askFromUserAsync();
+
QScopedPointer<OAuth, QScopedPointerObjectDeleteLater<OAuth>> _asyncAuth;
};