diff options
| author | Juha Vuolle <juha.vuolle@qt.io> | 2024-11-06 09:57:40 +0200 |
|---|---|---|
| committer | Juha Vuolle <juha.vuolle@qt.io> | 2024-11-21 12:17:49 +0200 |
| commit | 1496af579473595847c94b8a25bd2124879ee031 (patch) | |
| tree | 714a70678b3dd33c924db716f9f9d5e8b57a4de2 /src/oauth/qoauth2authorizationcodeflow.cpp | |
| parent | 841eb3b84a1d7c0fb7fedbd35aed6073f6fcdd14 (diff) | |
Move refresh token request creation to baseclass private
This way it can be shared with the upcoming device flow implementation.
Change-Id: I086dd0de04d7a8fe3681cbb6dd7b48b0d5df3fd7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
| -rw-r--r-- | src/oauth/qoauth2authorizationcodeflow.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp index c90fa98..44e8252 100644 --- a/src/oauth/qoauth2authorizationcodeflow.cpp +++ b/src/oauth/qoauth2authorizationcodeflow.cpp @@ -384,29 +384,8 @@ void QOAuth2AuthorizationCodeFlow::refreshAccessToken() return; } - using Key = QAbstractOAuth2Private::OAuth2KeyString; - - QMultiMap<QString, QVariant> parameters; - QNetworkRequest request(d->accessTokenUrl); -#ifndef QT_NO_SSL - if (d->sslConfiguration && !d->sslConfiguration->isNull()) - request.setSslConfiguration(*d->sslConfiguration); -#endif - QUrlQuery query; - parameters.insert(Key::grantType, QStringLiteral("refresh_token")); - parameters.insert(Key::refreshToken, d->refreshToken); - parameters.insert(Key::clientIdentifier, d->clientIdentifier); - parameters.insert(Key::clientSharedSecret, d->clientIdentifierSharedKey); - if (d->modifyParametersFunction) - d->modifyParametersFunction(Stage::RefreshingAccessToken, ¶meters); - query = QAbstractOAuthPrivate::createQuery(parameters); - request.setHeader(QNetworkRequest::ContentTypeHeader, - QStringLiteral("application/x-www-form-urlencoded")); - - d->callTokenRequestModifier(request, QAbstractOAuth::Stage::RefreshingAccessToken); - - const QString data = query.toString(QUrl::FullyEncoded); - d->currentReply = d->networkAccessManager()->post(request, data.toUtf8()); + const auto [request, body] = d->createRefreshRequestAndBody(d->accessTokenUrl); + d->currentReply = d->networkAccessManager()->post(request, body); setStatus(Status::RefreshingToken); QNetworkReply *reply = d->currentReply.data(); |
