diff options
| author | Juha Vuolle <juha.vuolle@qt.io> | 2024-11-06 09:20:47 +0200 |
|---|---|---|
| committer | Juha Vuolle <juha.vuolle@qt.io> | 2024-11-21 12:17:45 +0200 |
| commit | 841eb3b84a1d7c0fb7fedbd35aed6073f6fcdd14 (patch) | |
| tree | 7113646a0623cb4d3fa980624cb8b87ff9e9a3d2 /src/oauth/qoauth2authorizationcodeflow.cpp | |
| parent | 1dc8abddc717abcfcec9828b492d92168cee8fa0 (diff) | |
Move RFC error response handling to baseclass private
This way it can be shared with the upcoming device flow implementation.
Change-Id: Ib5fd90f8f0e172068c383e3771624823573c08c8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
| -rw-r--r-- | src/oauth/qoauth2authorizationcodeflow.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp index a313ef3..c90fa98 100644 --- a/src/oauth/qoauth2authorizationcodeflow.cpp +++ b/src/oauth/qoauth2authorizationcodeflow.cpp @@ -93,32 +93,16 @@ void QOAuth2AuthorizationCodeFlowPrivate::_q_handleCallback(const QVariantMap &d Q_ASSERT(!state.isEmpty()); - const QString error = data.value(Key::error).toString(); - const QString code = data.value(Key::code).toString(); - const QString receivedState = fromUrlFormEncoding(data.value(Key::state).toString()); - - if (error.size()) { - // RFC 6749, Section 5.2 Error Response - const QString uri = data.value(Key::errorUri).toString(); - const QString description = data.value(Key::errorDescription).toString(); - qCWarning(loggingCategory, "Authorization stage: AuthenticationError: %s(%s): %s", - qPrintable(error), qPrintable(uri), qPrintable(description)); - -#if QT_DEPRECATED_SINCE(6, 13) - QT_IGNORE_DEPRECATIONS(Q_EMIT q->error(error, description, uri);) -#endif - Q_EMIT q->errorOccurred(error, description, uri); - - // Emit also requestFailed() so that it is a signal for all errors - emit q->requestFailed(QAbstractOAuth::Error::ServerError); + if (handleRfcErrorResponseIfPresent(data)) return; - } + const QString code = data.value(Key::code).toString(); if (code.isEmpty()) { qCWarning(loggingCategory, "Authorization stage: Code not received"); emit q->requestFailed(QAbstractOAuth::Error::OAuthTokenNotFoundError); return; } + const QString receivedState = fromUrlFormEncoding(data.value(Key::state).toString()); if (receivedState.isEmpty()) { qCWarning(loggingCategory, "Authorization stage: State not received"); emit q->requestFailed(QAbstractOAuth::Error::ServerError); |
