Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
-
3
-
15d779b3a (dev), 019f2201c (dev)
-
Foundation PM Staging
Description
The QAbstractOAuth class has function for setting the replyhandler:
// Setter: void QAbstractOAuth::setReplyHandler(QAbstractOAuthReplyHandler *handler); // Getter: QAbstractOAuthReplyHandler *QAbstractOAuth::replyHandler() const { Q_D(const QAbstractOAuth); return d->replyHandler ? d->replyHandler.data() : d->defaultReplyHandler.data(); }
Now importantly the getter returns a default handler (undocumented QOAuthOobReplyHandler)if the reply handler is not set.
However, when looking at the code in QOAuth2AuthorizationCodeFlow, it does not use this getter consistently. Instead we can
see different ways to connect:
QObjectPrivate::connect(d->replyHandler.data() ... // nullptr if handler is not set QAbstractOAuthReplyHandler *handler = replyHandler(); // default handler if handler not set QObject::connect(reply, &QNetworkReply::finished, handler,
As a result, if the handler is not set, there are warnings like this:
qt.core.qobject.connect: QObject::connect(QAbstractOAuthReplyHandler, QOAuth2AuthorizationCodeFlow): invalid nullptr parameter
And things are bound not to work as expected. It should be checked which is the better way and use handler consistently.
If the handler must always be set, then /that/ must be documented.
Attachments
Issue Links
- clones
-
QTBUG-124325 [OAuth] Document QOAuthHttpServerReplyHandler class
- Closed
- is cloned by
-
QTBUG-124327 [OAuth] PKCE support
- Closed
-
QTBUG-124344 [OAuth] Investigate Qt OAuth2 specifically on Windows and Linux
- Closed
For Gerrit Dashboard: QTBUG-124326 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
563478,4 | [OAuth2] use default handler if no handler is set | dev | qt/qtnetworkauth | Status: MERGED | +2 | 0 |
563779,2 | Clarify that reply handler is required for authorization code flow | dev | qt/qtnetworkauth | Status: MERGED | +2 | 0 |